mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 16:43:31 +01:00
fix(MessageReaction): Prevent event double fire from uncached messages (#6818)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user