Skip to content

Releases: tmijs/chat

v0.8.0

Choose a tag to compare

@AlcaDesign AlcaDesign released this 08 May 00:47

NPM Version

Install

npm i @tmi.js/chat@0.8.0

Changes

  • 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

Choose a tag to compare

@AlcaDesign AlcaDesign released this 03 Mar 01:19

NPM Version

Install

npm i @tmi.js/chat@0.7.5

Changes

  • 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 a messageDropped event and the message will throw an Error with the relevant reason.

Full Changelog: v0.7.4...v0.7.5

v0.7.4

v0.7.4 Pre-release
Pre-release

Choose a tag to compare

@AlcaDesign AlcaDesign released this 20 Dec 18:44

NPM Version

Install

npm i @tmi.js/chat@0.7.4

Changes

  • 6b7b7f8 feat: support new lead_moderator badge
    Adds a isLeadMod flag to user objects in events based on whether the lead_moderator badge 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.
    The isMod flag has been updated to check if the user has the moderator or lead_moderator badge instead of just relying on the mod tag. The mod tag may or may not be actually deprecated by Twitch and appears to be true only when the user is displaying the moderator badge specifically, therefore it's set to false when the lead_moderator badge is displaying.
    See the announcement on the Twitch Developer Forums.

  • 06bc02d fix: additional checks for some user booleans
    The isSubscriber flag uses the subscriber tag to determine if the user is subscribed, but a fallback badge check for subscriber or founder has been added. The isVip flag 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 the isBroadcaster flag has been added in relevant cases.

Full Changelog: v0.7.3...v0.7.4

v0.7.3

v0.7.3 Pre-release
Pre-release

Choose a tag to compare

@AlcaDesign AlcaDesign released this 30 Nov 15:44

NPM Version

Install

npm i @tmi.js/chat@0.7.3

Changes

  • 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 property didConnectAnonymously will 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

v0.7.2 Pre-release
Pre-release

Choose a tag to compare

@AlcaDesign AlcaDesign released this 30 Nov 15:39

NPM Version

Install

npm i @tmi.js/chat@0.7.2

Changes

  • 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 of joinDelayMs is 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 property didConnectAnonymously will keep track of if the Client connected anonymously.

Full Changelog: v0.7.1...v0.7.2

v0.7.1

v0.7.1 Pre-release
Pre-release

Choose a tag to compare

@AlcaDesign AlcaDesign released this 24 Nov 23:01

NPM Version

Install

npm i @tmi.js/chat@0.7.1

Changes

  • 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

v0.7.0 Pre-release
Pre-release

Choose a tag to compare

@AlcaDesign AlcaDesign released this 24 Nov 22:59

NPM Version

Install

npm i @tmi.js/chat@0.7

Changes

  • 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

v0.6.1 Pre-release
Pre-release

Choose a tag to compare

@AlcaDesign AlcaDesign released this 24 Nov 22:51

NPM Version

Install

npm i @tmi.js/chat@0.6.1

Changes

  • f54867c fix: params text in USERNOTICE may be empty

Full Changelog: v0.6.0...v0.6.1

v0.6.0

v0.6.0 Pre-release
Pre-release

Choose a tag to compare

@AlcaDesign AlcaDesign released this 24 Nov 22:50

NPM Version

Install

npm i @tmi.js/chat@0.6

Changes

  • 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 and isAction on the message object now represents if that occurred.
  • b923050fix!: 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

v0.5.0 Pre-release
Pre-release

Choose a tag to compare

@AlcaDesign AlcaDesign released this 24 Nov 22:36

NPM Version

Install

npm i @tmi.js/chat@0.5

Changes

  • 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 the emoteId property.
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 support by @greebowarrior #3
    The isBot boolean is now available on most user data (UserExtra). It is a check for the recently added bot-badge chat 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 the onSocketClose handler.
  • 70838d7 feat: add ability to cancel reconnecting
    • feat: adds a reason string for the recon[n]ecting event
    • fix: prevents other attempts to reconnect
      You can now cancel a reconnect attempt by calling client.keepalive.cancelReconnect if it's available.
      A reason string is now in the reconnecting event 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
    msgParamMonths was mistakenly assumed to always be 0 for subgifts when that's only true for subs and resubs. Those events use msgParamCumulativeMonths for 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

Full Changelog: v0.4.1...v0.5.0