I want ! for choose at nightbot

Asked Jun 17, 2024·1 reply·Last activity 2 years 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.

someone can give me random !food or movie othes pls

1 reply

Here's an example for you.

$(eval a=`$(urlfetch json https://zoeballz.uk/_Nightbot/random_line_test/lines.txt)`.split(`#`);a[Math.floor(Math.random()*a.length)])

It reads the lines from a text file. In this case it's https://zoeballz.uk/_Nightbot/random_line_test/lines.txt and picks a random line from it.

This particular file contains.........

This is line 1.#
This is the second line.#
This is probably the 3rd line.#
Looks like this is a 4th line.

Feel free to give it a try.
NOTE: Each line finishes with a "#" except the last line. These are needed.

You can create your own text file on your own website or on Pastebin or something and change the URL in the command to point to your own file.

🙂