How to exclude someone from nightbot response

Hello, im using now command "$(user) hugged $(urlfetch https://2g.be/twitch/randomviewer.php?channel=$(channel)) <3 " but this command is also considering bots, can I somehow exclude them to make nightbot hug only real users?

@nostalogy

Try this:

$(user) hugged $(eval r=`$(urlfetch json http://tmi.twitch.tv/group/user/$(channel)/chatters)`;try{c=JSON.parse(r).chatters;a=c.moderators.concat(c.staff,c.admins,c.global_mods,c.viewers).filter(n=>!["$(user)","name1","name2","name3"].some(o=>n.toLowerCase()==o.toLowerCase()));a.length>0?a[Math.floor(Math.random()*a.length)]:`No chatters!`}catch(e){`Error: ${e.message}: ${r}`.substr(0,400)})

Somewhere within this code is an array of usernames:

["$(user)","name1","name2","name3"]

Replace name1/name2/name3 with the usernames you want to filter out. If you want to add more usernames, make sure each username is bounded by quotes "" and separated by commas.

I think its working, thank you very much.

1 Like

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