Check if channel is in emote only chat? #474
Answered
by
AlcaDesign
Cass-dev-web
asked this question in
Q&A
-
Hey, Is it possible to check if a channel is in emote only mode? Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
AlcaDesign
Jun 15, 2021
Replies: 1 comment 3 replies
-
There's an 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, or any of the other state types. const channel = '#alca';
if(roomstate.has(channel)) {
const rs = roomstate.get(channel);
// "In #alca emote-only is disabled"
console.log(`In ${channel} emote-only is ${rs['emote-only'] ? 'enabled' : 'disabled'}`);
} |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
Cass-dev-web
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There's an
emoteonly
event that you can use: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:
Then later just check the map to know if it's in emote-only mode, …