I've seen the command a few time now but can't figure out how to get it to work.
I want to see what mods are currently in chat. I know there is /mods but this shows all mods for the channel. I only want to see those that are active in the channel as of the command being run.
A similar command i've seen is the !hosts one but i could't replicate for mods. Any ideas?
12 replies
Polar Cat
Hey @Candid Dragon!
I'm not sure what you're referring to, but you could use the Mod View for that:
Candid Dragon
Yeah, i was hoping i could create a custom command to call for this information and display in chat. It's possible with javascript but i'm just not sure what to call for. Wasn't sure if there was an api for this information etc.
Polar Cat
You're actually right, reading this post again reminded me of a possible solution using the Twitch API, I just forgot the link, so here's the solution you're looking for:
!addcom !mods $(eval `The current active moderators are: ${$(urlfetch json https://tmi.twitch.tv/group/user/$(channel)/chatters).chatters.moderators.join(`, `)}`;)
Grand Ant
there is a way to "block" other bot names? I dont want this command to list streamelements for example
Candid Dragon
Perfect, thanks Emily!
Polar Cat
Hey @Grand Ant!
Of course, just replace BOT_n by the names of the bots you want to exclude from the list!
!addcom !mods $(eval mods=$(urlfetch json https://tmi.twitch.tv/group/user/$(channel)/chatters).chatters.moderators;bots=[`BOT_1`,`BOT_2`,...,`BOT_x`];bots.forEach(b=>mods=mods.filter(m=>m.toLowerCase()!=b.toLowerCase()));`The current active moderators are: ${mods.join(`, `)}`;)
Grand Ant
i replaced bot_n with streamelements and now nightbot response is "The current active moderators are: ". Like it doesnt say anything, its just blank :(
Grand Ant
oh i forgot to write the channel name, sorry. But now it says "Nightbot: Missing } in template expression"
Polar Cat
Grand Ant said: oh i forgot to write the channel name, sorry.
You don't need to write the channel name, $(channel) replaces the field automatically.
Grand Ant said: now it says “Nightbot: Missing } in template expression”
The error you get means that you deleted something that shouldn't have been deleted.
Grand Ant said: nightbot response is "The current active moderators are: ". Like it doesnt say anything, its just blank
If the list of active moderators is empty, except for bots we filter out, then the response will give no name. Active moderators means moderators that are currently actively watching the stream and/or talking in the chat. If the stream isn't live there's low chances you'll get any mod listed. And finally, note that the Twitch API regarding the active chatters isn't live, it's refreshed periodically, so sometimes you'll have to wait for a bit to get the name of an active mod in the list. If however, you want the full mods list, regardless of how active they are, just do /mods.
That being said, this is the command to filter out both Nightbot and Streamelements from the active mods list:
!addcom !mods $(eval mods=$(urlfetch json https://tmi.twitch.tv/group/user/$(channel)/chatters).chatters.moderators;bots=[`Nightbot`,`Streamelements`];bots.forEach(b=>mods=mods.filter(m=>m.toLowerCase()!=b.toLowerCase()));`The current active moderators are: ${mods.join(`, `)}`;)
Grand Ant
Polar Cat said: !addcom !mods $(eval The current active moderators are: ${$(urlfetch json https://tmi.twitch.tv/group/user/$(channel)/chatters).chatters.moderators.filter(m=>[Nightbot,Streamelements].forEach(b=>m.toLowerCase()!=b.toLowerCase())).join(, )};)
thank you so much emily <3
Grand Ant
well the streamer where im a mod just go online and the command with the bot names blocked doesn´t work, it response blank :(, i use the first command that you give ryan where the bot names are not blocked and it works, all the mods get listed, its weird. Sorry for my english im trying my best lmao
Polar Cat
Right, so last time I couldn't test it and I expected it to work, this time I tested it properly, and indeed, it needs to be fixed:
!addcom !mods $(eval mods=$(urlfetch json https://tmi.twitch.tv/group/user/$(channel)/chatters).chatters.moderators;bots=[`BOT_1`,`BOT_2`,...,`BOT_x`];bots.forEach(b=>mods=mods.filter(m=>m.toLowerCase()!=b.toLowerCase()));`The current active moderators are: ${mods.join(`, `)}`;)
As before, replace BOT_n by the names of the bots you want to exclude from the list!
Sorry about that, I thought it would work with no issue.
Note: it appears it takes 5 min after a mod joined for them to appear in the list.
Didn't find your answer? The community is on Discord.