Browse Source

Fixed Mention prefix detection

tags/1.0-rc
RogueException 9 years ago
parent
commit
c191f65c63
1 changed files with 8 additions and 2 deletions
  1. +8
    -2
      src/Discord.Net.Commands/Extensions/MessageExtensions.cs

+ 8
- 2
src/Discord.Net.Commands/Extensions/MessageExtensions.cs View File

@@ -29,10 +29,16 @@


int endPos = text.IndexOf('>'); int endPos = text.IndexOf('>');
if (endPos == -1) return false; if (endPos == -1) return false;
if (text.Length < endPos + 2 || text[endPos + 1] != ' ') return false; //Must end in "> "


ulong userId; ulong userId;
if (!MentionUtils.TryParseUser(text.Substring(0, endPos), out userId)) return false;
return userId == user.Id;
if (!MentionUtils.TryParseUser(text.Substring(0, endPos + 2), out userId)) return false;
if (userId == user.Id)
{
argPos = endPos + 2;
return true;
}
return false;
} }
} }
} }

Loading…
Cancel
Save