Trouble pulling from pastebin

I am trying to set up a command that will pull a random roast from a pastebin I made. I haven’t used a pastebin before, so I’m sure there’s some issues I have in there. I can’t figure it out for the life of me. The error I’m getting is “Unexpected identifier ‘You’ [:1:129]”.

Here’s the code: $(eval a=$(urlfetch json ).split(“|”);a[Math.floor(Math.random()*a.length)])

I was going to use, but it seems the server is down so I went to controlc instead.

Thanks in advance!

yeah, same issue for me. idk hov to fix?

I have searched a bit and realized that works. (should be in raw)

I swapped over for the raw format, but I’m still getting the same error code. Is it the format of my pastebin?

Updated code with the new pastebin location:

$(eval a=$(urlfetch json ).split(“|”);a[Math.floor(Math.random()*a.length)])

it’s because u’ve used backticks both around your $(urlfetch) AND in your quotes… so what it sees is `[` as a string and the first word in the first quote (You) outside of the backticks (it would also see every other word of the first quote outside of the backticks, but the first one already threw the error)… few ways to fix… personally i’d probably change all the |'s to commas and remove the .split("|")
… but u could instead, remove the brackets ([]) inside the linked paste and change the backticks around the $(urlfetch) to quotes (this makes it look kinda cool in discord)

Thank you! I changed the backticks around the url to quotes, and removed the backticks from the pastebin. Works perfect now

1 Like

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