mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 09:33:32 +01:00
Minor refactor of Actions
This commit is contained in:
@@ -12,26 +12,18 @@ class MessageReactionAdd extends Action {
|
||||
handle(data) {
|
||||
const user = this.client.users.get(data.user_id);
|
||||
if (!user) return false;
|
||||
|
||||
// Verify channel
|
||||
const channel = this.client.channels.get(data.channel_id);
|
||||
if (!channel || channel.type === 'voice') return false;
|
||||
|
||||
// Verify message
|
||||
const message = channel.messages.get(data.message_id);
|
||||
if (!message) return false;
|
||||
|
||||
if (!data.emoji) return false;
|
||||
|
||||
// Verify reaction
|
||||
const reaction = message._addReaction(data.emoji, user);
|
||||
if (reaction) this.client.emit(Constants.Events.MESSAGE_REACTION_ADD, reaction, user);
|
||||
|
||||
if (reaction) {
|
||||
this.client.emit(Constants.Events.MESSAGE_REACTION_ADD, reaction, user);
|
||||
}
|
||||
|
||||
return {
|
||||
message,
|
||||
reaction,
|
||||
user,
|
||||
};
|
||||
return { message, reaction, user };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user