Nightbot Math.random and Pastebin command help

Asked Jun 23, 2021·1 reply·Last activity 5 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.

ok, so i need some help doing this command for a few streamers
!commands add !love -cd=5 $(eval Math.round(Math.random())==0?$(eval var love = "$(urlfetch Pastebin_LINK) ".split(","); love[Math.floor(Math.random() * (love.length - 1))];) :$(eval var love = "$(urlfetch Pastebin_LINK2) ".split(","); love[Math.floor(Math.random() * (love.length - 1))];))

i have to many characters for 1 pastebin so i was thinking, was there a way i could make it so that there is a math random to choose a math random, so practically the first random does a 50/50 and once it choose one of those then that will do a math random between my Pastebins

here is an examble of a pastebin im going to put into each side (https://pastebin.com/hMfZSTZe)

1 reply

Yeah that’s possible but there shouldn’t be a limit on the characters in your pastebin but reguardless this should work:

$(eval a=`$(urlfetch json link1)`.split(`,`);b=`$(urlfetch json link2)`.split(`,`);c=`${a[Math.floor(Math.random()*a.length)]},${b[Math.floor(Math.random()*b.length)]}`.split(`,`);c[Math.floor(Math.random()*c.length)]})