NightDev Community Forums

Commands returns [Error Connecting To WebEval Service]


Hii guys, Thank you for taking your time reading this and replying!
i saw other post similiar to mine and i tried out what they did but it didnt work for me! :frowning:

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

This is what i have in my commands return:
$(eval q=decodeURIComponent("$(querystring)"); var jokes = $(urlfetch json","); jokes[Math.floor(Math.random() * jokes.length)])

I do not know much about Nightbot and how it all works so please forgive me if i made a noob mistake or anything :frowning:

If someone knows how to fix my problem, ill be thankfull for ever!
Sorry for bad english, i tried to fix some grammer mistakes!

Have a nice day!


that is not a proper json format, thus error occur, you can refer to the correct format by using w3school.


I looked it up but i have no knowledge about this kind of stuff, Is there a way that you maybe can help me ouy?



The last line in the pastebin link contains a comma, therefore running a split() with a comma separator will result in an array of jokes where the last item is just an empty string. If Nightbot chooses to output this empty string, it will instead output “[Error Connecting to WebEval Service]”. The following code should accommodate for the extra comma:

$(eval a=$(urlfetch json`,`);a[Math.floor(Math.random()*(a.length-1))])


Thank you alot! i think i do understand a little what you said.
correct me if im wrong but seems like i had to remove the last comma?
But again, thank you alot for helping out. appreciate it !


The code I posted above already takes the last comma into account, so there is now no need to remove it.


okay awesome! got it