mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
* feat(GuildPreview): method — fetchGuildPreview * feat(GuildPreview): structure — GuildPreview * feat(GuildPreview): update typings * fix(GuildPreview): remove typedef for Features — already exists * refactor(GuildPreview): update JSDocs & method * feat(GuildPreview): implement DiscoverySplash function * fix(GuildPreview): description & error handling for id * fix(GuildPreview): misleading description, assign emojis correctly * feat(GuildPreview): func DisplaySplash & GuildPreviewEmoji interface * fix(Typings): satisfy TSLint * fix(GuildPreview): toJSON - returns a value now * feat(GuildPreview): add fetchPreview method on instance of Guild * feat(GuildPreview): update typings * fix: missing client constructor * fix: typo in typings * feat(BaseEmoji): implement BaseEmoji — parent for emoji instances * feat(BaseEmoji): refactor - GuildEmoji extends BaseEmoji now * feat(BaseEmoji): refactor - adjust emojis prop to BaseEmoji instance * feat(BaseEmoji): not documented fully - GuildPreviewEmoji * feat(BaseEmoji): update typings * fix: remove duplicate typing properties - inherited * fix: remove redundant methods & properties - inherited / already set * fix: let -> const * fix: typings - put BaseEmoji after BaseClient * fix: remove _clone method - redundant * refactor(GuildPreview): emojis should be a collection * refactor: rename base class, move relevant props there and expose roles * fix(GuildPreview): update emojis in _patch * fix(Typings): remove empty line, add Client#fetchGuildPreview * feat: export GuildPreview * fix(Typings): add GuildPreview#discoverSplash, icon, and splash Co-authored-by: LxveFades <twitchisadeck@gmail.com> Co-authored-by: Crawl <icrawltogo@gmail.com> Co-authored-by: SpaceEEC <spaceeec@yahoo.com>
59 lines
1.4 KiB
JavaScript
59 lines
1.4 KiB
JavaScript
'use strict';
|
|
|
|
const Emoji = require('./Emoji');
|
|
|
|
/**
|
|
* Parent class for {@link GuildEmoji} and {@link GuildPreviewEmoji}.
|
|
* @extends {Emoji}
|
|
*/
|
|
class BaseGuildEmoji extends Emoji {
|
|
constructor(client, data, guild) {
|
|
super(client, data);
|
|
|
|
/**
|
|
* The guild this emoji is a part of
|
|
* @type {Guild|GuildPreview}
|
|
*/
|
|
this.guild = guild;
|
|
|
|
/**
|
|
* Array of role ids this emoji is active for
|
|
* @name BaseGuildEmoji#_roles
|
|
* @type {Snowflake[]}
|
|
* @private
|
|
*/
|
|
Object.defineProperty(this, '_roles', { value: [], writable: true });
|
|
|
|
this._patch(data);
|
|
}
|
|
|
|
_patch(data) {
|
|
if (data.name) this.name = data.name;
|
|
|
|
/**
|
|
* Whether or not this emoji requires colons surrounding it
|
|
* @type {boolean}
|
|
* @name GuildEmoji#requiresColons
|
|
*/
|
|
if (typeof data.require_colons !== 'undefined') this.requiresColons = data.require_colons;
|
|
|
|
/**
|
|
* Whether this emoji is managed by an external service
|
|
* @type {boolean}
|
|
* @name GuildEmoji#managed
|
|
*/
|
|
if (typeof data.managed !== 'undefined') this.managed = data.managed;
|
|
|
|
/**
|
|
* Whether this emoji is available
|
|
* @type {boolean}
|
|
* @name GuildEmoji#available
|
|
*/
|
|
if (typeof data.available !== 'undefined') this.available = data.available;
|
|
|
|
if (data.roles) this._roles = data.roles;
|
|
}
|
|
}
|
|
|
|
module.exports = BaseGuildEmoji;
|