Help me with my !funfact command

Asked Feb 22, 2025·1 reply·Last activity 1 year 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.

Hi, I'm trying to set my !funfact command. I was looking at other posts about this topic but im not from the US and our pastebin website has different ulr.

The one I was trying is:

$(eval facts= "$(urlfetch json https://pastebin.com/raw/nSNNj5tA)".split(";"); facts[Math.floor(Math.random() * (facts.length - 1))])

but my website url is https://www.pastebin.cz/cs/p/mho65Xi , and when I replace it in the command nightbot replies with "Unexpected identifier 'cs' [<context>:1:36]"

Thanks for help

1 reply

Try the following:

$(eval let facts = `$(urlfetch json https://pastebin.com/raw/nSNNj5tA)`.split(`;`).map(line=>line.trim()); facts[Math.floor(Math.random() * facts.length)])

If you're trying to use a different Pastebin service, you'll need to make sure you're using the raw file link. It won't work if there's other content at the url (like a webpage).