Can Nightbot not pull from pastebin anymore?

I am trying to create and use a pokemon battle command. The command is below:

!battle
A wild $(user) appears & attacks $(touser)! $(user) uses $(eval a=$(urlfetch json Pokemon Move - Pastebin.com);a[Math.floor(Math.random()*a.length)]). $(eval var a=[“It misses…”,“It’s super effective! $(touser) faints”,"It’s not very effective… "]; a[Math.floor(Math.random()*a.length)];)!

The command itself works but it gives an error code when trying to pull from the pastebin link. Error code here:

“Code generation from strings disallowed for this context”

Is there a fix or workaround I can use?

Thanks in advance

You weren’t using commas in the json file which is very important

!battle A wild $(user) appears & attacks $(touser)! $(user) uses $(eval a=$(urlfetch json https://pastebin.com/raw/6Qef9Ld7);a[Math.floor(Math.random()*a.length)]). $(eval let b=[“It misses…”,“It’s super effective! $(touser) faints”,"It’s not very effective… "];b[Math.floor(Math.random()*b.length)])!

I’ll remove the file so Please copy the pastebin content to your pastebin and use it

That fixed the pastebin issue but now the second part where it’s supposed to say super effective, not very, etc. is saying invalid token? Any idea what the hang up is there?

Hey @SirZebulon!

Your first issue is that you’re not using the raw version of the Pastebin, your second issue is that you’re not using the proper quotation marks: “”, instead of "", also, you can clean your command a bit this way:

$(eval p=$(urlfetch json https://pastebin.com/raw/6Qef9Ld7); r=["It misses...","It's super effective! $(touser) faints!","It's not very effective..."]; `A wild $(user) appears and attacks $(touser)! $(user) uses ${p[Math.floor(Math.random()*p.length)]}. ${r[Math.floor(Math.random()*r.length)]}`)

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