fix: Cached message emoji cleanup at MESSAGE_REACTION_REMOVE_EMOJI (#1835)

MESSAGE_REACTION_REMOVE_EMOJI events were triggering REST calls by invoking `RemoveAllReactionsForEmoteAsync` instead of `RemoveReactionsForEmote`, the latter being to handle cached message state cleanup.
This commit is contained in:
moiph
2021-05-08 11:45:53 -07:00
committed by GitHub
parent 4c9910cf71
commit 8afef8245c

View File

@@ -1482,7 +1482,7 @@ namespace Discord.WebSocket
var cacheable = new Cacheable<IUserMessage, ulong>(cachedMsg, data.MessageId, isCached, async () => await channel.GetMessageAsync(data.MessageId).ConfigureAwait(false) as IUserMessage); var cacheable = new Cacheable<IUserMessage, ulong>(cachedMsg, data.MessageId, isCached, async () => await channel.GetMessageAsync(data.MessageId).ConfigureAwait(false) as IUserMessage);
var emote = data.Emoji.ToIEmote(); var emote = data.Emoji.ToIEmote();
cachedMsg?.RemoveAllReactionsForEmoteAsync(emote); cachedMsg?.RemoveReactionsForEmote(emote);
await TimedInvokeAsync(_reactionsRemovedForEmoteEvent, nameof(ReactionsRemovedForEmote), cacheable, channel, emote).ConfigureAwait(false); await TimedInvokeAsync(_reactionsRemovedForEmoteEvent, nameof(ReactionsRemovedForEmote), cacheable, channel, emote).ConfigureAwait(false);
} }