Show current mods in chat command

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?

Hey @ryanisnub!

I’m not sure what you’re referring to, but you could use the Mod View for that:

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.

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(`, `)}`;)

there is a way to “block” other bot names? I dont want this command to list streamelements for example

Perfect, thanks Emily!

1 Like

Hey @jotammz98!

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(`, `)}`;)
2 Likes

i replaced bot_n with streamelements and now nightbot response is "The current active moderators are: ". Like it doesnt say anything, its just blank :frowning:

oh i forgot to write the channel name, sorry. But now it says “Nightbot: Missing } in template expression”

You don’t need to write the channel name, $(channel) replaces the field automatically.

The error you get means that you deleted something that shouldn’t have been deleted.

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(`, `)}`;)
1 Like

thank you so much emily <3

1 Like

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

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.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.