Closed Cass-dev-web closed 3 years ago
The roomstate event will tell you all of the room states and update with changes over time. 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);
}
});
Here's the Twitch Docs on ROOMSTATE https://dev.twitch.tv/docs/irc/tags#roomstate-twitch-tags Then later just check the map to know if it's in emote-only mode.
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'}`);
}
There's also a separate emoteonly
event
client.on('emoteonly', (channel, enabled) => {
console.log(`[${channel}] Emote-only mode ${enabled ? 'enabled' : 'disabled'}`);
});
Hey,
Is it possible to check if a channel is in emote only mode?
Thanks!