[Custom API] Random Viewer

How to remove some users from the list? such as bots

From this command
$(user) sometext $(urlfetch https://2g.be/twitch/randomviewer.php?channel=$(channel)).

This command fetches the list of chatters, removes the unwanted names, then selects a random chatter from the list.

$(user) sometext $(eval r=`$(urlfetch json http://tmi.twitch.tv/group/user/$(channel)/chatters)`;try{c=JSON.parse(r).chatters;a=c.vips.concat(c.moderators,c.staff,c.admins,c.global_mods,c.viewers).filter(n=>![`$(user)`,"Nightbot","UnwantedName3"].some(o=>n.toLowerCase()==o.toLowerCase()));a.length?a[Math.floor(Math.random()*a.length)]:"No chatters"}catch(e){`Couldn't fetch the list of chatters: ${e}: ${r}`.slice(0,400)})

Replace "$(user)","Nightbot","UnwantedName3" with the users you don’t want. Make sure to follow the pattern of putting the names in quotes and separating them by commas.

2 Likes

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