buddy

node MVC discord bot
Log | Files | Refs | README

ReactionEmoji.js (705B)


      1 'use strict';
      2 
      3 const Emoji = require('./Emoji');
      4 const Util = require('../util/Util');
      5 
      6 /**
      7  * Represents a limited emoji set used for both custom and unicode emojis. Custom emojis
      8  * will use this class opposed to the Emoji class when the client doesn't know enough
      9  * information about them.
     10  * @extends {Emoji}
     11  */
     12 class ReactionEmoji extends Emoji {
     13   constructor(reaction, emoji) {
     14     super(reaction.message.client, emoji);
     15     /**
     16      * The message reaction this emoji refers to
     17      * @type {MessageReaction}
     18      */
     19     this.reaction = reaction;
     20   }
     21 
     22   toJSON() {
     23     return Util.flatten(this, { identifier: true });
     24   }
     25 
     26   valueOf() {
     27     return this.id;
     28   }
     29 }
     30 
     31 module.exports = ReactionEmoji;