Create NightBot command help

Hello, I’m trying to make a command that prints a line from pastebin with a certain probability, for example 30%. If the other 70% worked, then a line from another pastebin is displayed.
The bottom line is that the user types a command, for example: !pun and a pun from is displayed with a certain probability. Or if the probability did not work, the roast is displayed from
What pastebin needs to be edited and separated with “|” I know and will do later. But I can’t figure out how to do something like “If rng < 70; insert pun command here else; insert roast command here

Please, help.

Hey @inariel!

You can’t call either of two commands following an if/else, but you can have different outputs, it’ll just be within the same command.

If you’re going to use the vertical line | as the separator — don’t put one at the end of the last option — then this is how you make such command:

$(eval p = '$(urlfetch json'.split('|'); r = '$(urlfetch json'.split('|'); Math.random() < 0.7 ? p[Math.floor(Math.random() * p.length)] : r[Math.floor(Math.random() * r.length)];)
1 Like

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