fix(MessageReaction): Prevent event double fire from uncached messages (#6818)

This commit is contained in:
Jiralite
2021-10-16 23:16:05 +01:00
committed by GitHub
parent 38cc89e5ae
commit 267a4b3f68
2 changed files with 14 additions and 11 deletions

View File

@@ -717,14 +717,17 @@ class Message extends Base {
*/
async react(emoji) {
if (!this.channel) throw new Error('CHANNEL_NOT_CACHED');
emoji = this.client.emojis.resolveIdentifier(emoji);
await this.channel.messages.react(this.id, emoji);
return this.client.actions.MessageReactionAdd.handle({
user: this.client.user,
channel: this.channel,
message: this,
emoji: Util.parseEmoji(emoji),
}).reaction;
return this.client.actions.MessageReactionAdd.handle(
{
user: this.client.user,
channel: this.channel,
message: this,
emoji: Util.resolvePartialEmoji(emoji),
},
true,
).reaction;
}
/**