Support for legacy secrets was removed in v7. If you're using v6 with the legacySecrets: true
flag on,
you have two options to mitigate this:
This should only be done if you have just a few subscriptions (a maximum of about 50-100).
Both of these steps will take a while and cause downtime for your application.
apiClient.eventSub.deleteAllSubscriptions()
once.legacySecrets
config option removed, and ignore the warning.If you do this correctly, this will not cause any downtime other than the time necessary for the restarts/deployments themselves, even though the last step is the same as in the other process.
legacySecrets: 'migrate'
..migrate()
method.legacySecrets
config option removed, and ignore the warning.The auth-electron
package was removed, as Twitch does not support embedding their login page in Electron anymore.
There is no direct replacement for this. You need to implement some kind of communication channel
between your application and the browser instead.
Make sure that all Twurple packages are up-to-date and on the same version.
On a unix-like system with the jq
utility installed, you can use one of these handy one-liners for that:
# for yarn
jq -r '.dependencies | keys[] | select(. | startswith("@twurple/"))' package.json | xargs yarn add
# for npm
jq -r '.dependencies | keys[] | select(. | startswith("@twurple/"))' package.json | xargs printf '%s@latest\n' | xargs npm install --save
Many methods used moderator
parameters to select the authenticated user from the AuthProvider
to call an endpoint with.
This was removed, and you can now either directly use the broadcaster as context
or use the asUser
or asIntent
methods on the ApiClient to override the context.
await apiClient.moderation.deleteChatMessages(broadcaster, broadcaster, messageId); await apiClient.moderation.deleteChatMessages(broadcaster, messageId);
await apiClient.moderation.deleteChatMessages(broadcaster, moderator, messageId); await apiClient.asUser( moderator, async ctx => await ctx.moderation.deleteChatMessages(broadcaster, messageId) )
This applies to the following methods:
Similarly, the following methods have been changed to not require to pass the client ID explicitly anymore,
as it's already provided by your AuthProvider
instance:
HelixUser
subscription and follower shortcutsThe HelixUser class has some shortcuts to determine subscriber status.
The already existing methods switched from broadcaster authentication to user subscription
to have their names and this
context make more sense, and new methods for broadcaster context were added.
Similarly, the follower methods were changed to use the new authenticated follower APIs, as the unauthenticated versions will be shut down by Twitch soon.
Check the documentation of the HelixUser class for more information.
The onRefresh
and onRefreshFailure
config options from RefreshingAuthProvider have been removed
in favor of event listener methods of the same name. This was done to be in line with all other event listener methods.
const authProvider = new RefreshingAuthProvider({
clientId,
clientSecret,
onRefresh: async (userId, newTokenData) => await fs.writeFile(`./tokens.${userId}.json`, JSON.stringify(newTokenData, null, 4), 'utf-8'),
});
authProvider.onRefresh(async (userId, newTokenData) => await fs.writeFile(`./tokens.${userId}.json`, JSON.stringify(newTokenData, null, 4), 'utf-8'));
The methods parseEmotes
and parseEmotesAndBits
were removed from the ChatMessage class.
The function parseChatMessage replaces both of these.
chatClient.onMessage((channel, user, text, msg) => {
const parts = msg.parseEmotes();
const parts = parseChatMessage(text, msg.emoteOffsets);
// more code
});
The function accepts a cheermote list as an optional third parameter,
but rather than taking an array of full objects like parseEmotesAndBits
took, it takes just an array of names.
The format parameter was completely removed,
as the cheermote can be formatted by calling the HelixCheermoteList#getCheermoteDisplayInfo method
on the instance you have already fetched for getting the list of names.
chatClient.onMessage(async (channel, user, text, msg) => { const cheermotes = await apiClient.bits.getCheermotes(msg.userInfo.userId); const parts = msg.parseEmotesAndBits(cheermotes, { background, state, scale }); const parts = parseChatMessage(text, msg.emoteOffsets, cheermotes.getPossibleNames()); // more code });
When authentication and token refreshing fails, RefreshingAuthProvider will now cache that failure. This results means that attempts to use authentication for the users that failed will now throw a CachedRefreshFailureError instead of a variety of other errors that could happen when trying to refresh.
Promise
handlingThe ChatClient methods connect
and reconnect
have been changed to be synchronous.
If you have been using .then()
to handle the promises returned by these methods, you should change this.
await
will not break, but is useless now.
All chat events now internally remove the leading #
from the channel name.
If you previously used naive methods like channel.slice(1)
to cut it off, you should remove that.
The utility method toUserName from the @twurple/chat
package is not as naive, but effectively useless now.
A few things were renamed for clarity.
Old | New |
---|---|
PrivateMessage | ChatMessage |
ChatClient#onR9k | ChatClient#onUniqueChat |
In order to pass specific options like proxy credentials to your API calls,
you must now augment the TwitchApiCallFetchOptions interface from the @twurple/api-call
package.
Its reference entry will show you the most common cases.