Browse Source

fix: don't assume the member will always be included on MESSAGE_CREATE

This resolves #1153.

Member objects are only included on a message when the user has
transitioned from an offline state to an online state (i think?), so
this change will fall back to the prior behavior, where we just create
an incomplete member object for these states.
pull/1167/head
Christopher F 7 years ago
parent
commit
500cd6ee1a
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      src/Discord.Net.WebSocket/DiscordSocketClient.cs

+ 6
- 1
src/Discord.Net.WebSocket/DiscordSocketClient.cs View File

@@ -1158,7 +1158,12 @@ namespace Discord.WebSocket
if (author == null)
{
if (guild != null)
author = guild.AddOrUpdateUser(data.Member.Value); //per g250k, we can create an entire member now
{
if (data.Member.IsSpecified) // member isn't always specified...
author = guild.AddOrUpdateUser(data.Member.Value); //per g250k, we can create an entire member now
else
author = guild.AddOrUpdateUser(data.Author.Value); // user has no guild-specific data
}
else if (channel is SocketGroupChannel)
author = (channel as SocketGroupChannel).GetOrAddUser(data.Author.Value);
else


Loading…
Cancel
Save