Random Multiple Messages when calling a Command

Hello everyone, did you notice that some Live Radios Integrated with Nightbot have custom commands that allow Nightbot to say multiple responses like Jokes or something?

Someone who knows how to do it, please reply. I’m about to make an advanced OBS Live transmision.
Thank y’all.

Hey @BachoAv!

You can achieve this with the following command:

!addcom !randomjoke -cd=5 $(eval a=[`JOKE_1`,`JOKE_2`,`JOKE_3`,`JOKE_x`]; a[Math.floor(Math.random()*a.length)])

With this one you’ll be limited by the amount of characters for each joke, since you have a limit of 500 characters total from Twitch chat, and each joke must not go above 400 characters.

If you want a more flexible joke command, you can use a Pastebin file, I recommend creating an account so you can update the file later.
Add a joke per line and end each line with and # except the last joke, although, don’t use an # inside your joke. The file should look like this:
1st joke#
2nd joke#
Last joke

Then save the file, copy the URL of the file and add /raw like this: https://pastebin.com/raw/abcdefgh
Finally replace PASTEBIN_URL in the following command with the link and copy the command in your chat:

!addcom !randomjoke -cd=5 $(eval a=`$(urlfetch json PASTEBIN_URL)`.split(`#`); a[Math.floor(Math.random()*a.length)])

With this you’ll still be limited to 400 characters per joke on Twitch, but you can add more jokes to the command.

Hope this helps!

1 Like

I don’t know if i already answered this message. but anyways. Thanks a million.
:smiley: IT WOKED.

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