UNPKG

@twitchfy/chatbot

Version:

A powerful node module to make your own Twitch ChatBot

85 lines (84 loc) 2.16 kB
import { Base } from './Base'; import type { ChatBot } from './ChatBot'; import type { EventSubConnection } from '../enums'; import type { FetchEmote } from '../types'; /** * The base emote class. */ export declare class BaseEmote<T extends EventSubConnection, K extends EmoteType = EmoteType> extends Base<T> { /** * The id of the emote. */ readonly id: string; /** * The name of the emote. */ readonly name: string; /** * The base data of the emote. */ protected data: BaseEmoteData; /** * Creates a new instance of the base emote. * @param chatbot The current instance of the chatbot. * @param data The base data of the emote. */ constructor(chatbot: ChatBot<T>, data: BaseEmoteData); /** * The Id of the owner of the emote. */ get ownerId(): string | null; /** * The Id of the emote set. */ get setId(): string | null; /** * Whether the emote is static. */ get static(): boolean; /** * Whether the emote is animated. */ get animated(): boolean; /** * Check if the emote is a global Twitch emote. * @returns A boolean indicating whether the emote is a global Twitch emote. */ isGlobal(): this is BaseEmote<T, 'global'>; /** * Check if the emote is a custom channel emote. * @returns A boolean indicating whether the emote is a channel emote. */ isChannel(): this is BaseEmote<T, 'channel'>; /** * Fetches the emote from the API. * @returns The fetched emote. Returns null if the emote was not found. */ fetch(): Promise<FetchEmote<T, K> | null>; } /** * The data of the base emote. */ export interface BaseEmoteData { /** * The id of the emote. */ id: string; /** * The id of the owner of the emote. */ owner_id: string; /** * The id of the emote set. */ emote_set_id: string; /** * The format of the emote. */ format: ('static' | 'animated')[]; /** * The name of the emote. */ name: string; } export type EmoteType = 'global' | 'channel';