BaseGuildEmoji.js (1394B)
1 'use strict'; 2 3 const Emoji = require('./Emoji'); 4 5 /** 6 * Parent class for {@link GuildEmoji} and {@link GuildPreviewEmoji}. 7 * @extends {Emoji} 8 */ 9 class BaseGuildEmoji extends Emoji { 10 constructor(client, data, guild) { 11 super(client, data); 12 13 /** 14 * The guild this emoji is a part of 15 * @type {Guild|GuildPreview} 16 */ 17 this.guild = guild; 18 19 /** 20 * Array of role ids this emoji is active for 21 * @name BaseGuildEmoji#_roles 22 * @type {Snowflake[]} 23 * @private 24 */ 25 Object.defineProperty(this, '_roles', { value: [], writable: true }); 26 27 this._patch(data); 28 } 29 30 _patch(data) { 31 if (data.name) this.name = data.name; 32 33 /** 34 * Whether or not this emoji requires colons surrounding it 35 * @type {boolean} 36 * @name GuildEmoji#requiresColons 37 */ 38 if (typeof data.require_colons !== 'undefined') this.requiresColons = data.require_colons; 39 40 /** 41 * Whether this emoji is managed by an external service 42 * @type {boolean} 43 * @name GuildEmoji#managed 44 */ 45 if (typeof data.managed !== 'undefined') this.managed = data.managed; 46 47 /** 48 * Whether this emoji is available 49 * @type {boolean} 50 * @name GuildEmoji#available 51 */ 52 if (typeof data.available !== 'undefined') this.available = data.available; 53 54 if (data.roles) this._roles = data.roles; 55 } 56 } 57 58 module.exports = BaseGuildEmoji;