Proxy messages with a mention before tags

This commit is contained in:
Ske
2019-06-27 10:38:45 +02:00
parent 53037f7d52
commit 7eeaea39fe
4 changed files with 32 additions and 10 deletions

View File

@@ -69,6 +69,18 @@ namespace PluralKit.Bot
throw Errors.AvatarDimensionsTooLarge(image.Width, image.Height);
}
}
public static bool HasMentionPrefix(string content, ref int argPos)
{
// Roughly ported from Discord.Commands.MessageExtensions.HasMentionPrefix
if (string.IsNullOrEmpty(content) || content.Length <= 3 || (content[0] != '<' || content[1] != '@'))
return false;
int num = content.IndexOf('>');
if (num == -1 || content.Length < num + 2 || content[num + 1] != ' ' || !MentionUtils.TryParseUser(content.Substring(0, num + 1), out _))
return false;
argPos = num + 2;
return true;
}
}
class PKSystemTypeReader : TypeReader