EmoteFetcher

EmoteFetcher

new EmoteFetcher(optionsopt)

Description:
  • Fetches and caches emotes.

Source:
Parameters:
Name Type Attributes Default Description
options object <optional>
{}

Fetcher's options.

Properties
Name Type Attributes Default Description
twitchAppID string <optional>

Your app ID for the Twitch API.

twitchAppSecret string <optional>

Your app secret for the Twitch API.

apiClient ApiClient <optional>

Bring your own Twurple ApiClient.

forceStatic boolean <optional>
false

Force emotes to be static (non-animated).

twitchThemeMode 'dark' | 'light' <optional>
'dark'

Theme mode (background color) preference for Twitch emotes.

Members

apiClient :ApiClient

Description:
  • Provided Twitch ApiClient.

Source:

Provided Twitch ApiClient.

Type:
  • ApiClient

apiClient :ApiClient

Description:
  • Twitch API client.

Source:

Twitch API client.

Type:
  • ApiClient

forceStatic :boolean

Description:
  • Force emotes to be static (non-animated).

Source:

Force emotes to be static (non-animated).

Type:
  • boolean

twitchThemeMode :'dark'|'light'

Description:
  • Theme mode (background color) preference for Twitch emotes.

Source:

Theme mode (background color) preference for Twitch emotes.

Type:
  • 'dark' | 'light'

emotes :Collection.<string, Emote>

Description:
  • Cached emotes. Collectionped by emote code to Emote instance.

Source:

Cached emotes. Collectionped by emote code to Emote instance.

Type:

channels :Collection.<string, Channel>

Description:
  • Cached channels. Collectionped by name to Channel instance.

Source:

Cached channels. Collectionped by name to Channel instance.

Type:

ffzModifiersFetched :boolean

Description:
  • Save if we fetched FFZ's modifier emotes once.

Source:

Save if we fetched FFZ's modifier emotes once.

Type:
  • boolean

(readonly, nullable) globalChannel :Channel

Description:
  • The global channel for Twitch, BTTV and 7TV.

Source:

The global channel for Twitch, BTTV and 7TV.

Type:

Methods

(private) _setupChannel(channelId, formatopt) → {Channel}

Description:
  • Sets up a channel

Source:
Parameters:
Name Type Attributes Description
channelId number

ID of the channel.

format string <optional>

The type file format to use (webp/avif).

Throws:

When Twitch Client ID or Client Secret were not provided.

Type
Error
Returns:
  • A Channel instance.
Type
Channel

(private) _getRawTwitchEmotes(id) → {Promise.<Array.<object>>}

Description:
  • Gets the raw Twitch emotes data for a channel.

Source:
Parameters:
Name Type Description
id number

ID of the channel.

Returns:
  • A promise that resolves to an array of raw Twitch emote data.
Type
Promise.<Array.<object>>

(private) _cacheTwitchEmote(channelId, data, existingEmoteopt) → {TwitchEmote}

Description:
  • Converts and caches a raw twitch emote.

Source:
Parameters:
Name Type Attributes Description
channelId number

ID of the channel.

data object

Raw data.

existingEmote TwitchEmote <optional>

Existing emote to cache.

Returns:
  • A TwitchEmote instance.
Type
TwitchEmote

(private) _getRawBTTVEmotes(idopt) → {Promise.<Array.<object>>}

Description:
  • Gets the raw BTTV emotes data for a channel. Use null for the global emotes channel.

Source:
Parameters:
Name Type Attributes Description
id number <optional>

ID of the channel.

Returns:
  • A promise that resolves to an array of raw BTTV emote data.
Type
Promise.<Array.<object>>

(private) _cacheBTTVEmote(channelId, data, existingEmoteopt) → {BTTVEmote}

Description:
  • Converts and caches a raw BTTV emote.

Source:
Parameters:
Name Type Attributes Description
channelId number

ID of the channel.

data object

Raw data.

existingEmote BTTVEmote <optional>

Existing emote to cache.

Returns:
  • A BTTVEmote instance.
Type
BTTVEmote

(private) _getRawFFZEmoteSet(id) → {Promise.<Array.<object>>}

Description:
  • Gets the raw FFZ emote data from a set.

Source:
Parameters:
Name Type Description
id number

ID of the set.

Returns:
  • A promise that resolves to an array of raw FFZ emote data.
Type
Promise.<Array.<object>>

(private) _getRawFFZEmotes(id) → {Promise.<Array.<object>>}

Description:
  • Gets the raw FFZ emotes data for a channel.

Source:
Parameters:
Name Type Description
id number

ID of the channel.

Returns:
  • A promise that resolves to an array of raw FFZ emote data.
Type
Promise.<Array.<object>>

(private) _cacheFFZEmote(channelId, data, existingEmoteopt) → {FFZEmote}

Description:
  • Converts and caches a raw FFZ emote.

Source:
Parameters:
Name Type Attributes Description
channelId number

ID of the channel.

data object

Raw data.

existingEmote FFZEmote <optional>

Existing emote to cache.

Returns:
  • A FFZEmote instance.
Type
FFZEmote

(private) _getRawSevenTVEmotes(idopt) → {Promise.<Array.<object>>}

Description:
  • Gets the raw 7TV emotes data for a channel.

Source:
Parameters:
Name Type Attributes Description
id number <optional>

ID of the channel.

Returns:
  • A promise that resolves to an array of raw 7TV emote data.
Type
Promise.<Array.<object>>

(private) _cacheSevenTVEmote(channelId, data, format, existingEmoteopt) → {SevenTVEmote}

Description:
  • Converts and caches a raw 7TV emote.

Source:
Parameters:
Name Type Attributes Description
channelId number

ID of the channel.

data object

Raw data.

format string

The type file format to use (webp/avif).

existingEmote SevenTVEmote <optional>

Existing emote to cache.

Returns:
  • A SevenTVEmote instance.
Type
SevenTVEmote

fetchTwitchEmotes(channelopt) → {Promise.<Collection.<string, TwitchEmote>>}

Description:
  • Fetches the Twitch emotes for a channel. Use null for the global emotes channel.

Source:
Parameters:
Name Type Attributes Description
channel number <optional>

ID of the channel.

Returns:
  • A promise that resolves to a collection of TwitchEmotes.
Type
Promise.<Collection.<string, TwitchEmote>>

fetchBTTVEmotes(channelopt) → {Promise.<Collection.<string, BTTVEmote>>}

Description:
  • Fetches the BTTV emotes for a channel. Use null for the global emotes channel.

Source:
Parameters:
Name Type Attributes Description
channel number <optional>

ID of the channel.

Returns:
  • A promise that resolves to a collection of BTTVEmotes.
Type
Promise.<Collection.<string, BTTVEmote>>

(async) fetchFFZEmotes(channelopt) → {Promise.<Collection.<string, FFZEmote>>}

Description:
  • Fetches the FFZ emotes for a channel.

Source:
Parameters:
Name Type Attributes Description
channel number <optional>

ID of the channel.

Returns:
  • A promise that resolves to a collection of FFZEmotes.
Type
Promise.<Collection.<string, FFZEmote>>

fetchSevenTVEmotes(channelopt, optionsopt) → {Promise.<Collection.<string, SevenTVEmote>>}

Description:
  • Fetches the 7TV emotes for a channel.

Source:
Parameters:
Name Type Attributes Description
channel number <optional>

ID of the channel.

options object <optional>

Options for fetching.

Properties
Name Type Attributes Description
format 'webp' | 'avif' <optional>

The type file format to use (webp/avif).

Returns:
  • A promise that resolves to a collection of SevenTVEmotes.
Type
Promise.<Collection.<string, SevenTVEmote>>

fromObject(emotesArrayopt) → {Array.<Emote>}

Description:
  • Converts emote Objects to emotes

Source:
Parameters:
Name Type Attributes Description
emotesArray object <optional>

An array of emote objects

Throws:

When an emote has an unknown type.

Type
TypeError
Returns:
  • An array of Emote instances.
Type
Array.<Emote>