UNPKG

@twitchfy/chatbot

Version:

A powerful node module to make your own Twitch ChatBot

48 lines (47 loc) 1.44 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Emote = void 0; const BaseEmote_1 = require("./BaseEmote"); /** * Represents a Twitch emote. It could be either a global emote or a channel emote. */ class Emote extends BaseEmote_1.BaseEmote { /** * The data of the emote returned from the API. */ emoteData; /** * Creates a new instance of the emote. * @param chatbot The current instance of the chatbot. * @param data The data of the emote returned from the API. */ constructor(chatbot, data) { super(chatbot, data); this.emoteData = data; } /** * Checks whether the emote is light theme. */ get hasLightTheme() { return this.emoteData.theme_mode.includes('light'); } /** * Checks whether the emote is dark theme. */ get hasDarkTheme() { return this.emoteData.theme_mode.includes('dark'); } /** * Gets the URL of the emote. * @param options The options to get the URL of the emote. * @returns Returns the URL of the emote. */ getURL(options) { return this.emoteData.template .replace(/{{id}}/g, this.id) .replace(/{{format}}/g, options?.format || 'static') .replace(/{{theme_mode}}/g, options?.theme || 'light') .replace(/{{scale}}/g, options?.scale || '1.0'); } } exports.Emote = Emote;