Fixed Mention.GetUserIds, dont mention the same user multiple times.

This commit is contained in:
RogueException
2015-10-25 23:03:42 -03:00
parent 1014176d2e
commit 5f06b8084b
2 changed files with 3 additions and 3 deletions

View File

@@ -119,7 +119,7 @@ namespace Discord
private async Task<Message> SendMessage(Channel channel, string text, bool isTextToSpeech) private async Task<Message> SendMessage(Channel channel, string text, bool isTextToSpeech)
{ {
Message msg; Message msg;
var userIds = !channel.IsPrivate ? Mention.GetUserIds(text) : new string[0]; var userIds = !channel.IsPrivate ? Mention.GetUserIds(text).Distinct() : new string[0];
if (Config.UseMessageQueue) if (Config.UseMessageQueue)
{ {
var nonce = GenerateNonce(); var nonce = GenerateNonce();

View File

@@ -6,8 +6,8 @@ namespace Discord
{ {
public static class Mention public static class Mention
{ {
private static readonly Regex _userRegex = new Regex(@"<@(?:[0-9]+?)>", RegexOptions.Compiled); private static readonly Regex _userRegex = new Regex(@"<@([0-9]+?)>", RegexOptions.Compiled);
private static readonly Regex _channelRegex = new Regex(@"<#(?:[0-9]+?)>", RegexOptions.Compiled); private static readonly Regex _channelRegex = new Regex(@"<#([0-9]+?)>", RegexOptions.Compiled);
/// <summary> Returns the string used to create a user mention. </summary> /// <summary> Returns the string used to create a user mention. </summary>
public static string User(User user) public static string User(User user)