UNPKG

@twurple/api

Version:

Interact with Twitch's API.

61 lines (60 loc) 2.21 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.HelixUserEmote = void 0; const tslib_1 = require("tslib"); const common_1 = require("@twurple/common"); const HelixEmoteBase_1 = require("./HelixEmoteBase"); const shared_utils_1 = require("@d-fischer/shared-utils"); /** * A Twitch user emote. */ let HelixUserEmote = class HelixUserEmote extends HelixEmoteBase_1.HelixEmoteBase { constructor(data, client) { super(data); this._client = client; } /** * The type of the emote. * * There are many types of emotes that Twitch seems to arbitrarily assign. * Check the relevant values in the official documentation. * * @see https://dev.twitch.tv/docs/api/reference/#get-user-emotes */ get type() { return this[common_1.rawDataSymbol].emote_type; } /** * The ID that identifies the emote set that the emote belongs to, or `null` if the emote is not from any set. */ get emoteSetId() { return this[common_1.rawDataSymbol].emote_set_id || null; } /** * The ID of the broadcaster who owns the emote, or `null` if the emote has no owner, e.g. it's a global emote. */ get ownerId() { return this[common_1.rawDataSymbol].owner_id || null; } /** * Gets all emotes from the emotes set, or `null` if emote is not from any set. */ async getAllEmotesFromSet() { return this[common_1.rawDataSymbol].emote_set_id ? await this._client.chat.getEmotesFromSets([this[common_1.rawDataSymbol].emote_set_id]) : null; } /** * Gets more information about the user that owns the emote, or `null` if the emote is not owned by a user. */ async getOwner() { return this[common_1.rawDataSymbol].owner_id ? await this._client.users.getUserById(this[common_1.rawDataSymbol].owner_id) : null; } }; exports.HelixUserEmote = HelixUserEmote; tslib_1.__decorate([ (0, shared_utils_1.Enumerable)(false) ], HelixUserEmote.prototype, "_client", void 0); exports.HelixUserEmote = HelixUserEmote = tslib_1.__decorate([ (0, common_1.rtfm)('api', 'HelixUserEmote', 'id') ], HelixUserEmote);