I’m trying to write a command for a friend’s stream (in which I’m a mod) wherein the command checks the calling user’s userlevel & prints a different response depending on if they’re a mod/broadcaster or not. I could easily do this with two different commands, but I’d prefer to have it as one, so everyone can call the same command.
The idea is to let people have silly duels in chat. Here’s what I have currently, which works just fine, but only mods+ can use it. Normal users have no way to retaliate. I’m making a distinction between mods & not mods because mods have a sword to bonk with.
!editcom -ul=moderator !bonk $(user) swordbonks @$(touser)! Have at thee!
I’m getting lost in trying to figure out the JavaScript for the If/Else conditional inside the command (assuming I actually need to use one) to check the caller’s userlevel and print the different responses. In particular, I’m not sure how to pass the userlevel check into the JavaScript If/Else to be the conditional variable. What I would like to happen with the output is this:
Mod+ calls the !bonk command: [This is what happens with the current version of the command.]
“@caller swordbonks @targetuser! Have at thee!”
Normal user calls the !bonk command:
“@caller bonks @targetuser! Have at thee!”
To my understanding, I can’t call twitch commands/variables inside of the JavaScript segment. If I actually can, then this problem no longer exists, as I know how to write the command.
Any help or direction would be appreciated, especially if there’s an easier way to code what I’m trying to do. Thank you!