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, [email protected]
part 13 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Code mentioned above
This still gets triggered as
still alive!
, even after bot no longer sends heartbeats
part 2
The actual problem (i think) occurs at 6:09am
, when client.on('debug',...)
logs [RECONNECT] Discord asked us to reconnect
. Logs for this are shown in the 4th screenshot. This (according to my still alive!
log) works, however the bot is not logging any heartbeats after this point and also stays offline/unresponsive.
Oddly enough, the still alive!
log can only be printed, if my "ping" (testing if fetching a hardcoded guild preview is successful) works. This means the bot still has API access internally, however is staying offline for reasons unknown to me.
This only gets "fixed", after i manually restart the bot. Any help would be really appreciated.
part 3