github twurple/twurple twitch@2.0.0
2.0.0

latest releases: v7.1.0, v7.1.0-pre.9, v7.1.0-pre.8...
4 years ago

Starting with 4.0.0, we started to use GitHub Releases for changelogs.

The old major version changelogs from the documentation has been copied here.

twitch

Handle TwitchClient#withCredentials now returning a Promise and having an additional argument

The StaticAuthProvider that is created when you use TwitchClient#withCredentials now throws when any scopes are requested that are not initially passed to it.

Because of that, a new parameter was added to TwitchClient#withCredentials that determines the initial scopes.

If this parameter is not given, the scopes are automatically determined using a call to the Twitch API.

Since this parameter was added before the refreshConfig parameter, it needs to be added when you need auto-refreshing (set it to undefined if you don't need it).

Change the return type of any implementations of AuthProvider#getAccessToken

This method should now return a full AccessToken object instead of the access token as a string.

Replace the usage of the method UserAPI#getUserEmotes without an argument

client.users.getUserEmotes() was essentially a shorthand for client.users.getUserEmotes(await client.users.getMe()), but with added technical complexity.

Instead of this, you can now use the method User#getEmotes, or just get your user ID from somewhere and use the method with the user parameter.

The AuthorizationError used only for this purpose was removed too.

Remove the pagination parameter in usages of HelixClipAPI

The second parameter named pagination in the methods HelixClipAPI#getClipsForBroadcaster and HelixClipAPI#getClipsForGame was a relic from 0.x days. They did not work at all.

If you still used it, you need to remove it - it got replaced by a new parameter that enables you to filter the clips by creation date.

Check your usage of StatusCodeError and other request errors

Whenever a request returned an error that was not caught by the library, a StatusCodeError (from the request library) was thrown.

Since request has been replaced by fetch-ponyfill, which does not throw an error on 4xx and 5xx HTTP status codes by itself,
we now expose a HTTPStatusCodeError type that you can catch instead. The status code is stored in the HTTPStatusCodeError#statusCode property.

For the same reason, RequestError is not a thing anymore. Instead, node-fetch exposes its own FetchError, and browsers differ widely.
Because of this, you should not rely on the types of these errors.

[Deprecation] Move all Kraken usage to client.kraken

client.bits, client.channels, client.chat, client.search, client.streams and client.users have all been deprecated and scheduled for removal in version 3.0.
Please use client.kraken.* instead. The names didn't change.

[Deprecation] Use client.badges instead of client.chat for the badges methods

The methods client.kraken.chat.getGlobalBadges and client.kraken.chat.getChannelBadges were misplaced in the ChatAPI class.
They have been moved to their own namespace outside of the new Kraken namespace, client.badges (BadgesAPI).

Both client.chat.get*Badges and client.kraken.chat.get*Badges will still work, but have been scheduled for removal in 3.0.

twitch-chat-client

Make sure you can get a token with the correct chat scopes

A few months ago, Twitch added the new chat scopes chat:read and chat:edit which removed support of the chat_login scope for client IDs that were created after this change. The client now defaults to requesting chat:read and (if you don't set the other new option readOnly) chat:edit. If you need to use chat_login instead (because you use an old client ID), you need to set the option legacyScopes.

This option is now necessary because the core client was made stricter in terms of requesting scopes on a token that can't get any scope upgrades.

Use the new method for parsing bits out of a message

The message objects returned by the events have been completely decoupled from the chat client itself. Thus, if you used PrivateMessage#getSeparateBits before, this method was removed as it relied on the client being available for fetching the possible cheermotes in the channel.

You now need to use CheermoteList#parseMessage from the core package instead.

twitch-pubsub-client

Rename PubSubClient to BasicPubSubClient

If you used the basic PubSubClient class before, it was renamed to BasicPubSubClient.

A new PubSubClient class was introduced that has a much smoother developer experience. It's the default export.

Pass an object instead of an argument list to the SingleUserPubSubClient constructor

The constructor of SingleUserPubSubClient was changed to take only a SingleUserPubSubClientOptions object.

Anyway, the new PubSubClient has an interface that's very similar to this class, but supports multiple users.
Consider using it instead of using SingleUserPubSubClient directly.

Remove any calls to SingleUserPubSubClient's onCommerce method

The commerce topic was abandoned by Twitch, so it was removed from the library as well.

Don't miss a new twurple release

NewReleases is sending notifications on new releases.