!funfact command

Asked Feb 20, 2023·2 replies·Last activity 3 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.

2 replies

Hey @Sunny Flamingo!

The 403 error means that Nightbot is forbidden to access your paste, open the paste in a private tab to find out how to fix that issue. 😉

Open the file logged in pastebin's creator account, go to "Edit" and change "Paste Exposure" to "Public" (Anyone can see this in their pastebin) or "Unilisted" (Only people with the link can see it). Keep the password disabled and save the file.

And you have an extra closing parenthesis that is finalizing the $(eval) before the "split()", change to:

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

If those %22 quotes are intended to appear at the end of the text, you can put:
!editcom !funfact $(eval facts= "$(urlfetch json https://pastebin.com/raw/jUrRJ2Pi)".split(";"); facts[Math.floor(Math.random() * (facts.length - 1))]+'"')
or
!editcom !funfact $(eval facts= "$(urlfetch json https://pastebin.com/raw/jUrRJ2Pi)".split(";"); facts[Math.floor(Math.random() * (facts.length - 1))]+decodeURI("%22"))