funfacts command

Asked Apr 21, 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.

Hey so I'm trying to get a command setup so it can pull random funfacts from my pastebin to my chat, but when I enter the command I just get this..
!addcom -cd=5 !truefacts Unexpected identifier
this is the command language I add in the message section.
!addcom -cd=5 !truefacts $(eval a=$(urlfetch json https://pastebin.com/raw/12efDFyQ);a[Math.floor(Math.random()*a.length)])
if everyone can help me it would be appericated.

1 reply

Hey @Plucky Pig!

You fetch the paste, but you forget to turn it into an array.

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