buddy

node MVC discord bot
Log | Files | Refs | README

MessageReactionRemoveAll.js (773B)


      1 'use strict';
      2 
      3 const Action = require('./Action');
      4 const { Events } = require('../../util/Constants');
      5 
      6 class MessageReactionRemoveAll extends Action {
      7   handle(data) {
      8     // Verify channel
      9     const channel = this.getChannel(data);
     10     if (!channel || channel.type === 'voice') return false;
     11 
     12     // Verify message
     13     const message = this.getMessage(data, channel);
     14     if (!message) return false;
     15 
     16     message.reactions.cache.clear();
     17     this.client.emit(Events.MESSAGE_REACTION_REMOVE_ALL, message);
     18 
     19     return { message };
     20   }
     21 }
     22 
     23 /**
     24  * Emitted whenever all reactions are removed from a cached message.
     25  * @event Client#messageReactionRemoveAll
     26  * @param {Message} message The message the reactions were removed from
     27  */
     28 
     29 module.exports = MessageReactionRemoveAll;