[Error Connecting To WebEval Service] but only sometimes.

Hi, I saw other post similar to mine and I tried out what they did but it didn’t work for me! I feel like I’m missing something really obvious but I can’t find it, so perhaps some one can review my code and tell me what’s wrong with it.

When I use my commands sometimes it works perfectly and sometimes it respond with:
[Error Connecting To WebEval Service]

Here’s the command
$(eval a="$(urlfetch json https://pastebin.com/raw/sbVm9YjE)".split(";");a[Math.floor(Math.random()*a.length)])​

I created many fun commands using this code, all of them function, except for this one. I feel like it has something to do with the URLs, but not sure how to remedy it. Also Im not too tech savvy, I’m comfortable with the code but I’ll need very basic instructions or examples for me to understand. Thank you for taking your time reading this and replying!

$(eval a=$(urlfetch json https://pastebin.com/raw/z0vVvLNa); a[Math.floor(Math.random()*a.length)])

I copied and pasted this into night bot and now I get this error when I try to trigger it
“Unexpected identifier”

I think you copied the 2 after the link

$(eval a=$(urlfetch json https://pastebin.com/raw/z0vVvLNa); a[Math.floor(Math.random()*a.length)])

Please copy the pastebin content to your pastebin and use that

Hey @SuzyStillwater!

Your code is correct, the error you get is when Nightbot’s API encounters an issue, there’s nothing you can do about it other than wait. However, I notice something that might cause an issue, but I’m not sure it’d throw such error, maybe: your last message doesn’t need to end with a semi-colon ;, remove it.

Oh thank you very much! I kind of thought it might be nightbot, I use this code all the time to make fun random question games in my stream and never ran into this issue before so I thought it might have been something I did but couldn’t see. Thank you and I’ll try fixing that last line too. :slight_smile:

1 Like

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