mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-06 22:07:55 +00:00
Proxy messages with a mention before tags
This commit is contained in:
parent
53037f7d52
commit
7eeaea39fe
4 changed files with 32 additions and 10 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue