Browse Source

Fixed nullref in Message.Update

tags/docs-0.9
RogueException 9 years ago
parent
commit
c280ed0bda
1 changed files with 13 additions and 4 deletions
  1. +13
    -4
      src/Discord.Net/Models/Message.cs

+ 13
- 4
src/Discord.Net/Models/Message.cs View File

@@ -228,15 +228,24 @@ namespace Discord
text = Mention.CleanChannelMentions(_client, server, text, mentionedChannels);
text = Mention.CleanRoleMentions(_client, server, text, mentionedRoles);
}
Text = text;

//MentionedUsers = mentionedUsers;
MentionedChannels = mentionedChannels;
MentionedRoles = mentionedRoles;
}
IsMentioningMe = model.Mentions
.Any(x => x.Id == _client.CurrentUserId) ||
(server != null && MentionedRoles.Any(x => server.CurrentUser.HasRole(x)));

if (server != null)
{
var me = server.CurrentUser;
IsMentioningMe = (MentionedUsers?.Contains(me) ?? false) ||
(MentionedRoles?.Any(x => me.HasRole(x)) ?? false);
}
else
{
var me = _client.CurrentUser;
IsMentioningMe = MentionedUsers?.Contains(me) ?? false;
}
}

public override bool Equals(object obj) => obj is Message && (obj as Message).Id == Id;


Loading…
Cancel
Save