Exclude specific user from command

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:

$(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. :slight_smile:

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. :slight_smile:

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