Character limit for random list pick

So I am trying to get a command that picks a random entry from a list (in my example it’s about getting a character to play in a game) but something like:

!commands add !godpick $(eval a=["Achilles", "Ares", "etc.", "etc"];a[Math.floor(Math.random() * a.length)])

Doesn’t work because of nightbots 500 letter limit for commands.

I tried to do it via a pastebin:

!commands add !godpick $(eval var god= "$(urlfetch https://pastebin.com/raw/PCMm1mWZ) ".split(","); god[Math.floor(Math.random() * (god.length - 1))];)

But even though the individual entries are much shorter, Nightbot apparently sees every pastebin with more than 400 letters as a single entry and blocks that too.

I googled a bit and found people with similar problems but no solution seemed to be applicable for my problem.
Anyone got an idea how to work around this problem ? Maybe it’s possible to use several shorter pastebins? How would one do that?

Use the urlfetch json variant.

$(urlfetch json https://pastebin.com/raw/PCMm1mWZ)
1 Like

Thanks so much. That worked. Have a nice day.

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