fix: MessageUpdated without author (#1858)

This commit is contained in:
Paulo
2021-05-28 13:39:38 -03:00
committed by GitHub
parent d176fef5de
commit 8b29e0feb4

View File

@@ -1359,6 +1359,8 @@ namespace Discord.WebSocket
{ {
//Edited message isnt in cache, create a detached one //Edited message isnt in cache, create a detached one
SocketUser author; SocketUser author;
if (data.Author.IsSpecified)
{
if (guild != null) if (guild != null)
{ {
if (data.WebhookId.IsSpecified) if (data.WebhookId.IsSpecified)
@@ -1389,6 +1391,10 @@ namespace Discord.WebSocket
return; return;
} }
} }
}
else
// 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); after = SocketMessage.Create(this, State, author, channel, data);
} }