Fixed crash with short mention activation strings
This commit is contained in:
@@ -97,10 +97,15 @@ namespace Discord.Commands
|
|||||||
//Check for mention
|
//Check for mention
|
||||||
if (cmdMsg == null && Config.AllowMentionPrefix)
|
if (cmdMsg == null && Config.AllowMentionPrefix)
|
||||||
{
|
{
|
||||||
if (msg.StartsWith(client.CurrentUser.Mention))
|
string mention = client.CurrentUser.Mention;
|
||||||
cmdMsg = msg.Substring(client.CurrentUser.Mention.Length + 1);
|
if (msg.StartsWith(mention) && msg.Length > mention.Length)
|
||||||
else if (msg.StartsWith($"@{client.CurrentUser.Name}"))
|
cmdMsg = msg.Substring(mention.Length + 1);
|
||||||
cmdMsg = msg.Substring(client.CurrentUser.Name.Length + 1);
|
else
|
||||||
|
{
|
||||||
|
mention = $"@{client.CurrentUser.Name}";
|
||||||
|
if (msg.StartsWith(mention) && msg.Length > mention.Length)
|
||||||
|
cmdMsg = msg.Substring(mention.Length + 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check using custom activator
|
//Check using custom activator
|
||||||
|
|||||||
Reference in New Issue
Block a user