NightDev Community Forums

Random Requests Command

Hi - this probably seems very simple given some of the threads I’ve read on here in the past so apologies if I’m being stupid but I’ve been looking around and can’t find any answers.

I’m wanting to set up a command where viewers can request something, for example !request blue

And then I’m wanting to be able to choose one at random whenever I feel like, by typing something along the lines of !request choose

And once I would type that Nighbot would then give me back one of the requests that a viewer typed in, with their username and their request.

I’m sure it is possible because I did see someone else do it, but I’m just not sure where to begin.

Thank you :slightly_smiling_face:

Hey @chloelunn9!

Yes, use ehsankia’s Quote System API, just the other way than usual:


You’ll get your TOKENS by clicking on the second link in the post, in the Manual Installation section, use these in the commands I wrote. To know where to look for your PUBLIC_TOKEN and PRIVATE_TOKEN, look at the field bellow:

$(urlfetch https://twitch.center/customapi/quote?token=PUBLIC_TOKEN&data=$(querystring))
$(urlfetch https://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=$(querystring))
$(urlfetch https://twitch.center/customapi/delquote?token=PRIVATE_TOKEN&data=$(querystring))

Keep your PRIVATE_TOKEN secret, don’t share it anywhere. Add the following commands from the dashboard. Don’t use the chat as anyone could monitor it and copy the token, they could then edit your data.


For your viewers to add items to the list, use the following command:
!request:

$(urlfetch https://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=$(user) - $(querystring))

To pick an item from the list of requests and remove it, make sure these commands userlevels are set to moderator:
!pick:

$(urlfetch https://twitch.center/customapi/quote?token=PUBLIC_TOKEN)

_pick:

$(eval d=`$(urlfetch https://twitch.center/customapi/delquote?token=PRIVATE_TOKEN&data=$(querystring))`; q=`$(query)`.split(` `); q.shift(); q.join(` `);)

:warning: _pick is the alias of !pick, therefore you need to write _pick in the alias field of !pick.


If you wish to empty the entire list of request, set this command’s userlevel to moderator:
!resetrequests:

$(urlfetch https://twitch.center/customapi/delquote?token=PRIVATE_TOKEN&clear=1)

Thank you so much - got it set up and working :slightly_smiling_face:

Is there any way to set it up for nightbot on YouTube or is that not possible because of the public and private tokens?

1 Like

It should work on YouTube just as well. The only restriction is to add a command from the chat—which I don’t recommend in this case because of the PRIVATE_TOKEN—you’d need the stream to be live.

Stupid question, but is that missing a () at the end?

1 Like

Oh ffff, you’re right, lmao! It was 1am when I wrote it, I missed it, thanks!
I updated the code in my reply.