Skip to content

2.8.0: toObject, fromObject, use your ApiClient

Compare
Choose a tag to compare
@mkody mkody released this 28 Jul 12:55
· 43 commits to master since this release

This release, in addition to upgrading our Twurple to 7.x, brings three new features:

  • Emote.toObject() (#31 - @Tzahi12345): You can export the data of an emote for caching or offline use.
    const emote = emoteFetcher.emotes.get('Kappa').toObject();
    /*
    {
        id: '25',
        type: 'twitch',
        code: 'Kappa',
        animated: false,
        channel_id: null,
        set: undefined
    }
    */
  • EmoteFetcher.fromObject() (#31 - @Tzahi12345): You can import an array of emotes directly into the fetcher.
    emoteFetcher.fromObject([emote]);
  • The EmoteFetcher now accepts an object as a third parameter for options. (#33)
    The only option for now is apiClient and it allows you to use your own @twurple/api's ApiClient object, in case you already have one or want to manage authentification without app tokens.
    Note that the first two parameters of EmoteFetcher will be unused in this case and can be left as null.
    const { ApiClient } = require('@twurple/api');
    const { StaticAuthProvider } = require('@twurple/auth');
    
    const authProvider = new StaticAuthProvider('<your client id>', '<your token>');
    const apiClient = new ApiClient({ authProvider });
    
    const fetcher = new EmoteFetcher(null, null, { apiClient });