Releases: tmijs/chat
Release list
v0.8.0
Install
npm i @tmi.js/chat@0.8.0Changes
- 0a52ad4
fix: add known strings to MessageDropped event reason type - a4616b5
fix: add missing message to viewerMilestone event
Also adds an explicit'watch-streak'type as it's the only use of the viewer milestone events so far. - fdbc93b
fix: removes combos event
This feature was removed from Twitch.
Full Changelog: v0.7.5...v0.8.0
v0.7.5
Install
npm i @tmi.js/chat@0.7.5Changes
- e9b7211
fix: support msg_warned NOTICEs for dropped messages
Sending a message to a channel where there is a pending warning for the bot user will now result in amessageDroppedevent and the message will throw an Error with the relevant reason.
Full Changelog: v0.7.4...v0.7.5
v0.7.4
Install
npm i @tmi.js/chat@0.7.4Changes
-
6b7b7f8
feat: support new lead_moderator badge
Adds aisLeadModflag to user objects in events based on whether thelead_moderatorbadge is being displayed in that message. If the user is a lead moderator but toggled their displayed badge to the regular moderator badge (sword), there will no longer be a way to determine if the user is a lead moderator in the IRC data.
TheisModflag has been updated to check if the user has themoderatororlead_moderatorbadge instead of just relying on themodtag. Themodtag may or may not be actually deprecated by Twitch and appears to be true only when the user is displaying themoderatorbadge specifically, therefore it's set to false when thelead_moderatorbadge is displaying.
See the announcement on the Twitch Developer Forums. -
06bc02d
fix: additional checks for some user booleans
TheisSubscriberflag uses thesubscribertag to determine if the user is subscribed, but a fallback badge check for subscriber or founder has been added. TheisVipflag also relies on a tag so badges have been added into the checks where relevant. To not fully rely on the badges, since the Twitch internal badge service can disappear sometimes, an additional check for theisBroadcasterflag has been added in relevant cases.
Full Changelog: v0.7.3...v0.7.4
v0.7.3
Install
npm i @tmi.js/chat@0.7.3Changes
- 4d968d7
fix: assume empty token means login anonymously(non-functional change in v0.7.2) - cdcdca0
fix: check the returned token value for emptiness(fixup)
If a function is passed to the Client token option, a falsy value (empty string, nullish, etc.) will result in the client connecting anonymously. The Client propertydidConnectAnonymouslywill track if the Client ended up connecting as an anonymous client despite a token function.
Full Changelog: v0.7.2...v0.7.3
v0.7.2
Install
npm i @tmi.js/chat@0.7.2Changes
- dadeff2
feat: add option to control the pending channel join min rate
You can now set a minimum rate for the Client to send join calls when it's automatically joining the channels list from the Client options and when reconnecting. The default value ofjoinDelayMsis 500 milliseconds (10 seconds / 20 calls). See the Twitch documentation on join rate limits for more information. Ping time is not taken into account and there is no jitter. 500ms should be about right to ensure no joins are dropped for rate limiting. I recommend a lower value like 350ms if there are a lot of channels to join.
This does not affect calling the join method directly if you want full control.
const client = new tmi.Client({ channels, joinDelayMs: 350 });- 2862802
fix: track if the client did connect anonymously
The Client propertydidConnectAnonymouslywill keep track of if the Client connected anonymously.
Full Changelog: v0.7.1...v0.7.2
v0.7.1
Install
npm i @tmi.js/chat@0.7.1Changes
- e54a8d8
feat: add user to combos redeem type
client.on('combos', e => {
switch(e.type) {
case 'redeem': {
console.log(`${e.user.login} redeemed a ${e.theme} Combo for ${e.bits} Bits`);
break;
}
}
});Full Changelog: v0.7.0...v0.7.1
v0.7.0
Install
npm i @tmi.js/chat@0.7Changes
- e3fd978
fix: remove "oauth:" from the start of tokens
While still required by Twitch, it was presumed only the actual token value was passed. This will make sure to strip the "oauth:" from the token before it gets re-added for sending to Twitch. - 6c899a6
fix: mark existing combos events as deprecated and fixup types
Twitch has changed has the "Combos" feature works. Instead of creating streaks, it has become simply a "gift redeem". - 2df293c
feat: add combos redeem type
client.on('combos', e => {
switch(e.type) {
case 'redeem': {
console.log(`A ${e.theme} Combo was redeemed for ${e.bits} Bits`);
break;
}
default: {
console.log(`The ${e.type} Combo event is still in use, open an issue on Github at tmijs/chat`);
}
}
});Full Changelog: v0.6.1...v0.7.0
v0.6.1
Install
npm i @tmi.js/chat@0.6.1Changes
- f54867c
fix: params text in USERNOTICE may be empty
Full Changelog: v0.6.0...v0.6.1
v0.6.0
Install
npm i @tmi.js/chat@0.6Changes
- fccfffd 89e5d6f
fix: message might be action mode in USERNOTICE
Messages sent through the USERNOTICE command could potentially be action messages. Action messages are messages that were sent starting with "/me " but are interpreted by Twitch which adds control characters (non-printable characters) to the message. They are now stripped andisActionon the message object now represents if that occurred. - b923050 ❗
fix!: remove goal from resub type sub events
In all of my data, I could not find any resub messages with goal related tags. Marked as a breaking change but goals are optional already. Userland code should be checking for the goal before using it on any event. - e3567ae
feat: add message to resub type sub events
This has been missing from the code for some reason. It has always been available from Twitch.
client.on('sub', e => {
switch(e.type) {
case 'resub': {
console.log(`${e.user.login} just resubbed for ${e.cumulativeMonths} months!`);
if(e.message.text) {
console.log(` ${e.user.login}: ${e.message.text}`);
}
break;
}
}
});Full Changelog: v0.5.0...v0.6.0
v0.5.0
Install
npm i @tmi.js/chat@0.5Changes
- 620364f
feat: add emote property to gigantifiedEmote reward
If a message has a gigantified emote reward, an emote property will return an object representing the emote instead of just theemoteIdproperty.
client.on('message', e => {
if(e.reward) {
switch(e.reward.type) {
case 'gigantifiedEmote': {
e.reward.emote.id === e.reward.emoteId; // true
// The last instance of the emote is the gigantified version:
e.reward.emote.indices.at(-1)?.[0];
break;
}
}
}
});- ce2559f
feat: add bot-badge supportby @greebowarrior #3
TheisBotboolean is now available on most user data (UserExtra). It is a check for the recently addedbot-badgechat badge on a message. See Chatbot Badge and Chat Identity in the Twitch developer documentation for a list of conditions to be met. This library currently does not support sending messages with the badge or appearing in the special chatter list section. This does not represent some list of known bad actors. The broadcaster is excluded from having this badge. - f76987d
fix: use this.close to fix reconnect loop
If reconnect is called, the client will close the socket without setting "wasCloseCalled" kicking off a separate reconnect call from theonSocketClosehandler. - 70838d7
feat: add ability to cancel reconnectingfeat: adds a reason string for the recon[n]ecting eventfix: prevents other attempts to reconnect
You can now cancel a reconnect attempt by callingclient.keepalive.cancelReconnectif it's available.
A reason string is now in thereconnectingevent to determine the reason for the reconnect.
client.on('reconnecting', e => {
if(e.attempts > 10) {
client.keepalive.cancelReconnect?.();
}
else {
// "Reconnecting: Ping timeout exceeded [attempt #] waiting #ms"
// "Reconnecting: RECONNECT command received [attempt ..."
// "Reconnect: Socket was closed unexpectedly [attempt ..."
// "Reconnect: reconnect called [attempt ..."
console.log(`Reconnecting: ${e.reason} [attempt ${e.attempts}] waiting ${e.waitTime}ms`);
}
});- 8923068
feat: add cumulativeMonths to subGift type sub events
msgParamMonthswas mistakenly assumed to always be0for subgifts when that's only true for subs and resubs. Those events usemsgParamCumulativeMonthsfor the cumulative months.
client.on('sub', e => {
switch(e.type) {
case 'subGift': {
console.log(`${e.user.login} gifted ${e.recipient.login} a Tier ${e.plan.tier} sub! ${e.recipient.login} has been subscribed for a cumulative ${e.cumulativeMonths} month${e.cumulativeMonths === 1 ? '' : 's'}.`);
break;
}
}
});- a547fc7
feat: add msg_banned_phone_number_alias to messageDropped event- Your message was dropped because the phone number on this account was banned on another account (an alias).
- e8bb3cf
feat: add socialSharing type to badgeUpgrade event
Emitted when a user shares that they earned or upgraded their Social Media badge. See How to Earn the Social Media Badge. As with other badge tier upgrade events, the user is able to type a message to send with it when sharing.
client.on('badgeUpgrade', e => {
switch(e.type) {
case 'socialSharing': {
console.log(`${e.user.login} upgraded their Social Media badge to level ${e.threshold}`);
break;
}
}
});New Contributors
- @greebowarrior made their first contribution in #3
Full Changelog: v0.4.1...v0.5.0