Mentioning a discord role

So in my server, we’re trying to use Nightbot to run a gambling channel, where you input a command to roll a number, and win a prize upon rolling certain numbers. I’ve gotten the command to the point where it successfully runs the numbers and outputs correct responses based on the rolled number, thanks to this thread: RNG with set responses for a range of possible numbers.

Here is the command:
$(eval z=decodeURIComponent;const a=z("$(querystring $(user))"),{die:b,responses:c}=JSON.parse(z("$(querystring $(urlfetch json see below for JSON data))")),d=(a=>Math.ceil(Math.random()*a))(b),e=((a,b)=>{const c=Object.keys(a).map(Number).sort((c,a)=>a-c);for(const d of c)if(b>=d)return a[d];throw new Error(“responses”)})(c,d);${a} rolls the dice and hits a ${d}. ${e})

And here is the JSON data:
“die”: 1000,
“responses”: {
“2”: “Better luck next time! :game_die:”,
“68”: “Try again! :game_die:”,
“70”: “Just keep rolling! :game_die:”,
“419”: “So close, but still no cigar.”,
“421”: “Maybe next time! :game_die:”,
“665”: “You’ll get it next time! :game_die:”,
“667”: “Good luck! You’ll need it. :game_die:”,
“776”: “Roll again! :game_die:”,
“778”: “So close, but so far away. Try again! :game_die:”,
“999”: “Oof, better luck next time. :game_die:”,
“1”: “Congratulations! @ Boss”,
“69”: “Haha, nice. Congrats! @ Boss”,
“420”: “Blaze it and congrats! @ Boss”,
“666”: “Congratulations on rolling the number of the Devil! @ Boss”,
“777”: “Now that’s some good luck! Congrats! @ Boss”,
“1000”: “Congratulations! @ Boss”

The problem is that I can’t get it to actually mention the Boss role. I tried using both $(@ user) and $(@ userid) but both ended up failing, and I’m not sure if that’s because the strings are embedded in the JSON or what. I’m not honestly very good at coding (I’ve only gotten this far by modifying what others have made), so any help is appreciated. Thank you!

Ps, the spaces are deliberate to keep from accidentally mentioning someone here.

UPDATE: Figured it out. <@the long string of numbers that makes up your discord id> does the trick!

1 Like

Glad you got it figured out.