$readrandline not working, help?

Hi, I tried to make a command where nightbot gives back a random line from a document. It looks like this: $readrandline(File location/docname.txt). Any suggestions on why it isn’t working?


Outside the Nightbot desktop app, it doesn’t have functionality for reading a local text file. You can check here for a list of Nightbot’s command variables, what they do, and how you can use them in commands.

This looks like a Streamlabs Chatbot variable, so it won’t work with Nightbot, I’d suggest you to have a look at SLCB Discord support server.

However, if you wish to get a random line from a file, you can create a Pastebin file and use $(urlfetch) to make it work with Nightbot.
When you create your file on Pastebin, create an account as well so you can go back and edit the file later on. In the file, end each line with a | (vertical bar), except for the last one.
Then use this in your command:

$(eval a=`$(urlfetch json https://pastebin.com/raw/XXXXXXXX)`.split(`|`); a[Math.floor(Math.random()*a.length)])

Don’t forget to replace XXXXXXXX with your paste ID, which can be found in its URL.

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