mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 03:23:29 +01:00
Clean up reactions, add remove all reactions (#890)
* Clean up reactions, add remove all reactions * Reorganize reactions * Re-add Gawdl3y's precious little inline * Update Message.js
This commit is contained in:
committed by
Schuyler Cebulskie
parent
a359f344d8
commit
5ed8098af8
@@ -8,6 +8,7 @@ class ActionsManager {
|
||||
this.register('MessageUpdate');
|
||||
this.register('MessageReactionAdd');
|
||||
this.register('MessageReactionRemove');
|
||||
this.register('MessageReactionRemoveAll');
|
||||
this.register('ChannelCreate');
|
||||
this.register('ChannelDelete');
|
||||
this.register('ChannelUpdate');
|
||||
|
||||
21
src/client/actions/MessageReactionRemoveAll.js
Normal file
21
src/client/actions/MessageReactionRemoveAll.js
Normal file
@@ -0,0 +1,21 @@
|
||||
const Action = require('./Action');
|
||||
const Constants = require('../../util/Constants');
|
||||
|
||||
class MessageReactionRemoveAll extends Action {
|
||||
handle(data) {
|
||||
const channel = this.client.channels.get(data.channel_id);
|
||||
if (!channel || channel.type === 'voice') return false;
|
||||
|
||||
const message = channel.messages.get(data.message_id);
|
||||
if (!message) return false;
|
||||
|
||||
message._clearReactions();
|
||||
this.client.emit(Constants.Events.MESSAGE_REACTION_REMOVE_ALL, message);
|
||||
|
||||
return {
|
||||
message,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = MessageReactionRemoveAll;
|
||||
Reference in New Issue
Block a user