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:
Programmix
2016-11-12 23:29:26 -08:00
committed by Schuyler Cebulskie
parent a359f344d8
commit 5ed8098af8
9 changed files with 97 additions and 26 deletions

View File

@@ -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');

View 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;