Pick a single result each from 5 different pastebins/ 500 length limit

So I got commands for a bot to pick a random single word from a single pastebin.

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

But now I want a command that picks one result each from 5 different pastebins (To pick a full team for a game. One pick from the list for each class.). Sadly just pasting my commands behind each other to access each individual pastebin is longer than the 500 length limit for nightbot.
Does anyone have any idea how to fix/get around this?

My current version is this (this is sadly above the 500 length limit):

!commands add !team warrior = $(eval var warrior= "$(urlfetch json
https://pastebin.com/raw/XUB7dJe1) ".split(","); warrior[Math.floor(Math.random() * (warrior.length - 1))];)
mage = $(eval var mage= "$(urlfetch json
https://pastebin.com/raw/Ad44zFbu) ".split(","); mage[Math.floor(Math.random() * (mage.length - 1))];)
hunter = $(eval var hunter= "$(urlfetch json
https://pastebin.com/raw/wpiNNqn2) ".split(","); hunter[Math.floor(Math.random() * (hunter.length - 1))];)
guardian = $(eval var guardian= "$(urlfetch json
https://pastebin.com/raw/EKNtmtQ5) ".split(","); guardian[Math.floor(Math.random() * (guardian.length - 1))];)
assassin = $(eval var assassin= "$(urlfetch json
https://pastebin.com/raw/rQhHvGPx) ".split(","); assassin[Math.floor(Math.random() * (assassin.length - 1))];)

Hey @esablaka!

One solution is to use an alias command, so here are the commands:

!addcom -ul=mod -a=_team !team $(eval w=`$(urlfetch json https://pastebin.com/raw/XUB7dJe1)`.split(`,`);w=w[Math.floor(Math.random()*w.length)];m=`$(urlfetch json https://pastebin.com/raw/Ad44zFbu)`.split(`,`);m=m[Math.floor(Math.random()*m.length)];h=`$(urlfetch json https://pastebin.com/raw/wpiNNqn2)`.split(`,`);h=h[Math.floor(Math.random()*h.length)];`Warrior: ${w} | Mage: ${m} | Hunter: ${h}`)

!addcom -ul=mod _team $(eval g=`$(urlfetch json https://pastebin.com/raw/EKNtmtQ5)`.split(`,`);g=g[Math.floor(Math.random()*g.length)];a=`$(urlfetch json https://pastebin.com/raw/rQhHvGPx)`.split(`,`);a=a[Math.floor(Math.random()*a.length)];`$(query) | Guardian: ${g} | Assassin ${a}`) 

I assumed you wanted the command to be for mod only because it would drive me crazy having people spamming it personally, so I added the -ul=mod part, if you want the command to be opened to everyone, remove it (in both commands).

2 Likes

Sorry for the late reply but that’s exactly what I was looking for. Thank you very much.

1 Like

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