fix: Fix after message remaining in MessageUpdated if message author wasn't in the payload (#1209)
* Fix leaving updated message as null when Discords doesn't include a message author in MESSAGE_UPDATE * Name! That! Parameter!
This commit is contained in:
committed by
Christopher F
parent
f6413bac59
commit
91e0f03bfd
@@ -1218,16 +1218,22 @@ namespace Discord.WebSocket
|
||||
cachedMsg.Update(State, data);
|
||||
after = cachedMsg;
|
||||
}
|
||||
else if (data.Author.IsSpecified)
|
||||
else
|
||||
{
|
||||
//Edited message isnt in cache, create a detached one
|
||||
SocketUser author;
|
||||
if (guild != null)
|
||||
author = guild.GetUser(data.Author.Value.Id);
|
||||
if (data.Author.IsSpecified)
|
||||
{
|
||||
if (guild != null)
|
||||
author = guild.GetUser(data.Author.Value.Id);
|
||||
else
|
||||
author = (channel as SocketChannel).GetUser(data.Author.Value.Id);
|
||||
if (author == null)
|
||||
author = SocketUnknownUser.Create(this, State, data.Author.Value);
|
||||
}
|
||||
else
|
||||
author = (channel as SocketChannel).GetUser(data.Author.Value.Id);
|
||||
if (author == null)
|
||||
author = SocketUnknownUser.Create(this, State, data.Author.Value);
|
||||
// Message author wasn't specified in the payload, so create a completely anonymous unknown user
|
||||
author = new SocketUnknownUser(this, id: 0);
|
||||
|
||||
after = SocketMessage.Create(this, State, author, channel, data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user