!funfact command

Can someone tell me what’s wrong with my command:

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

When i try it it’s says: “Remote Server Returned Code 403”

Hey @nseyano!

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. :wink:

1 Like

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”))

1 Like

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