Hey guys,
so I’m trying to exclude a specific user from a using a command, I’m quite new to this so I tried just using this:
Is there anyway to remove certain users from a response in a command? But read it from a text file or something? Cause I used 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.mess…
$(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)})
I put !addcom !command this^
and put their name instead of name1, but they’re still able to use the command and nightbot adds a random user from chat to the message. ^^ so I really have no idea how any of this works. I’d appreciate any help.
Ok simple mistake you found a command that excludes users from a command message what you want is pretty simple.
!addcom !CommandName $(eval `$(user)`==`NameOfUserYouWantToExclude`?` `:`Normal Command Response`)
1 Like
Works like a charm, thank you very much.
system
Closed
November 14, 2021, 8:55pm
4
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.