EmoteFetcher

EmoteFetcher

new EmoteFetcher(clientId, clientSecret, options)

Description:
  • Fetches and caches emotes.

Source:
Parameters:
Name Type Description
clientId string

The client id for the twitch api.

clientSecret string

The client secret for the twitch api.

options object

Additional options.

Properties
Name Type Description
apiClient ApiClient

Bring your own Twurple ApiClient.

Members

apiClient

Description:
  • Twitch api client.

Source:

Twitch api client.

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(channel_id, formatopt) → {Channel}

Description:
  • Sets up a channel

Source:
Parameters:
Name Type Attributes Default Description
channel_id int

ID of the channel.

format string <optional>
null

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

Throws:

When Twitch Client ID or Client Secret were not provided.

Type
Error
Returns:
Type
Channel

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

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

Source:
Parameters:
Name Type Description
id int

ID of the channel.

Returns:
Type
Promise.<Array.<object>>

(private) _cacheTwitchEmote(channel_id, data, existing_emoteopt) → {TwitchEmote}

Description:
  • Converts and caches a raw twitch emote.

Source:
Parameters:
Name Type Attributes Default Description
channel_id int

ID of the channel.

data object

Raw data.

existing_emote TwitchEmote <optional>
null

Existing emote to cache.

Returns:
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 Default Description
id int <optional>
null

ID of the channel.

Returns:
Type
Promise.<Array.<object>>

(private) _cacheBTTVEmote(channel_id, data, existing_emoteopt) → {BTTVEmote}

Description:
  • Converts and caches a raw BTTV emote.

Source:
Parameters:
Name Type Attributes Default Description
channel_id int

ID of the channel.

data object

Raw data.

existing_emote BTTVEmote <optional>
null

Existing emote to cache.

Returns:
Type
BTTVEmote

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

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

Source:
Parameters:
Name Type Description
id int

ID of the set.

Returns:
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 int

ID of the channel.

Returns:
Type
Promise.<Array.<object>>

(private) _cacheFFZEmote(channel_id, data, existing_emoteopt) → {FFZEmote}

Description:
  • Converts and caches a raw FFZ emote.

Source:
Parameters:
Name Type Attributes Default Description
channel_id int

ID of the channel.

data object

Raw data.

existing_emote FFZEmote <optional>
null

Existing emote to cache.

Returns:
Type
FFZEmote

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

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

Source:
Parameters:
Name Type Attributes Default Description
id int <optional>
null

ID of the channel.

Returns:
Type
Promise.<Array.<object>>

(private) _cacheSevenTVEmote(channel_id, data, format, existing_emoteopt) → {SevenTVEmote}

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

Source:
Parameters:
Name Type Attributes Default Description
channel_id int

ID of the channel.

data object

Raw data.

format string

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

existing_emote SevenTVEmote <optional>
null

Existing emote to cache.

Returns:
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 Default Description
channel int <optional>
null

ID of the channel.

Returns:
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 Default Description
channel int <optional>
null

ID of the channel.

Returns:
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 Default Description
channel int <optional>
null

ID of the channel.

Returns:
Type
Promise.<Collection.<string, FFZEmote>>

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

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

Source:
Parameters:
Name Type Attributes Default Description
channel int <optional>
null

ID of the channel.

format 'webp' | 'avif' <optional>
'webp'

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

Returns:
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:
Type
Array.<Emote>