If user else everyone

Ok so I tried to search and didn’t find anything anywhere…maybe I missed it somewhere…but so anyways

with the random user api being shut down I played around, banged my head against the wall, searched some more online trying to understand js and twitch…long story short here is a code (and I’m sure there’s better ways to do it but it works) to use in nightbot for when you want an action to be targeted at someone otherwise at everyone

$(eval a=decodeURIComponent(`$(querystring)`);b=`everyone`;a?a:b)

so for example let’s use the hug command

$(user) hugged $(eval a=decodeURIComponent(`$(querystring)`);b=`everyone`;a?a:b)!

so now if you type

!hug USERNAME

it will say: YOURNAME hugged USERNAME!

you can also use the @ to tag them

!hug @USERNAME

and if you don’t put a username and just type

!hug

it will say: YOURNAME hugged everyone!

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