Skip to content

Check if channel is in emote only chat? #474

Answered by AlcaDesign
Cass-dev-web asked this question in Q&A
Discussion options

You must be logged in to vote

There's an emoteonly event that you can use:

client.on('emoteonly', (channel, enabled) => {
	console.log(`[${channel}] Emote-only mode ${enabled ? 'enabled' : 'disabled'}`);
});

The roomstate event will tell you all of the room states and update with changes over time. Twitch Docs. Here's how you could track it:

const roomstate = new Map();
client.on('roomstate', (channel, state) => {
	if(roomstate.has(channel)) {
		const rs = roomstate.get(channel);
		Object.assign(rs, state);
	}
	else {
		roomstate.set(channel, state);
	}
});
client.on('part', (channel, username, self) => {
	if(self) {
		roomstate.delete(channel);
	}
});

Then later just check the map to know if it's in emote-only mode, …

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Cass-dev-web
Comment options

@AlcaDesign
Comment options

@Cass-dev-web
Comment options

Answer selected by Cass-dev-web
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #473 on June 15, 2021 02:39.