NightDev Community Forums

Nightbot FetchUrl Timeout Sending Error Messages

Hello there, I recently set up NightBot to use FetchUrl to integrate with the Google Sheets API. It was been working fantastically except for one minor problem, whenever someone uses a command to modify the sheets, since the Google Sheets API is slow, NightBot seems to timeout and return an error message such as “Error Connecting To Remote Server” or “Error Connecting To WebProxy Service”. The strange thing is most of the time the command still goes through just fine and I see my Google Sheets updated. I was wondering if there is any way to somehow control these messages so that they don’t say that there was an error. I’m using this with discord and the new members of my server (and even old members) sometimes get confused and think it didn’t go through. Any help would be greatly appreciated! Thanks!

Nightbot’s url fetcher always expects a response within 10 seconds after calling a remote API and will output such an error if it receives no response within that window. If you can manage to, make the API return early and use the response url header (which expires after 5 minutes) to send a reply to chat.

An alternative way to suppress the error messages, thought it will also suppress the API’s normal responses, is to nest the urlfetch in an eval like so. Replace API_URL_HERE with your API url:

$(eval `$(urlfetch API_URL_HERE)`;` `)

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