Need help with code for command please

I found a post on the forum setting up a random fact command. I followed the directions and ended up with this command.

$(eval responses = $(urlfetch json https://pastebin.com/raw/Jud9iwby).split(","); responses[Math.floor(Math.random() * return responses.length)])

I keep getting the error code “Right-hand side of ‘instanceof’ is not an object”

Can anyone point me in the right direction?

TIA

your json file is not valid json, which is why it fails to parse… you have unescaped double quotes in your double quotes, for example…

$(eval responses = $(urlfetch json https://pastebin.com/raw/uZmRLnw9).split(","); responses[Math.floor(Math.random() * return responses.length)])

okay i re-did the json file removing the double quotes inside my double quotes.

I still received the same message. Am I still doing something incorrectly?

The urlfetch part should be between quotes, the return at the end is not needed.

$(eval responses = `$(urlfetch json https://pastebin.com/raw/uZmRLnw9)`.split(","); responses[Math.floor(Math.random() * responses.length)])

thank you so much. that worked like a charm. appreciate you taking the time to respond and help me with my problem.

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