Bot stays offline/unresponsive after reconnect

I have my bot deployed on a server, which restarts its internet router every day at
4:32am
. To handle this, i implemented a
setInterval
, which runs every 30 seconds to check if the bot is still alive (function described below as
checkAliveAndRestart()
).

This "works" and logs the client in again and the bot is sending heartbeats again afterwards. As this occurs in the middle of the night when im still asleep, i dont have a way to verify if the bot is responsive after this restart at
4:32am
, but since it's sending out heartbeats, i have reason to believe it does (
checkAliveAndRestart()
also logs still alive). Logs for this are attatched in the first two screenshots.

(fyi no one interacted with the bot from 1am to 8:18am, so user interaction couldn't have crashed the bot,
client.on('debug', ...)
also never logged an error except at
4:32
, when it briefly lost internet)

(actual problem described part 2/3 due to character limit)

node v18.10.0, discord.js@14.7.1
part 1
log1.png
log2.png
log3.png
Was this page helpful?