Pastebin Nightbot Coding

Asked Sep 7, 2024·1 reply·Last activity 1 year ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

Hi, so I mainly use streamelements. But a friend I mod for uses Nightbot and he wants a cookie command where Nightbot randomly chooses a type of cookie thats beign given to the other user. I've made a list of responses for it to choose from on Pastebin, but can't seem to figure out how to code the command for it to work. I want it to look like (User) Gave (toUser) a Cookie! It's (random cookie type from the list)
Here is the pastebin url, and i know the digits behind the slash is the main thing i need
https://pastebin.com/ZnULbfEN

favicon.png

1 reply

Hiya! Try something like this:

!commands add !cookie $(user) gave $(touser) a Cookie! It's $(eval a='$(urlfetch json https://pastebin.com/raw/ZnULbfEN)'.split(','); a[Math.floor(Math.random()*a.length)])