Files
discord.js/src/structures/ReactionEmoji.js
Will Nelson cf7dcba1a5 Add toJSON methods (#1859)
* tojson things

* fix client

* ignore private properties

* remove extra property descriptors

* handle primitive flattening

* remove unused import

* add toJSON to collections

* reduce stateful props

* state

* allow custom prop names when flattening

* fix client

* fix build

* fix flatten docs

* remove guild.available, cleanup permissions, remove arbitrary id reduction

* fix util import

* add valueOf as needed, update member props

* fix incorrect merge

* update permissionoverwrites and permissions

remove serialization of permissions in PermissionOverwrites#toJSON.
change Permissions#toJSON to serialize permissions, by default excluding
admin checks.

* change Permissions#toJSON to return the primitive

* Permissions#toJSON explicitly return bitfield
2018-03-01 23:00:21 -06:00

30 lines
690 B
JavaScript

const Util = require('../util/Util');
const Emoji = require('./Emoji');
/**
* Represents a limited emoji set used for both custom and unicode emojis. Custom emojis
* will use this class opposed to the Emoji class when the client doesn't know enough
* information about them.
* @extends {Emoji}
*/
class ReactionEmoji extends Emoji {
constructor(reaction, emoji) {
super(reaction.message.client, emoji);
/**
* The message reaction this emoji refers to
* @type {MessageReaction}
*/
this.reaction = reaction;
}
toJSON() {
return Util.flatten(this, { identifier: true });
}
valueOf() {
return this.id;
}
}
module.exports = ReactionEmoji;