#How to make my bot reconnect automatically?

13 messages · Page 1 of 1 (latest)

ember jungleBOT
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

outer mesa
#

Could you please add a listener to shardError and check if it emits something?

remote aspen
#

npm i pm2

#

pm2 start file.js

edgy kite
#

it's not what you want

sweet lion
#

if you handle error events and discord.js can resume the websocket, it will do so

sweet lion
#

you always needed to handle error events to not crash

outer mesa
#

You received a regular close code on your websocket here… do you use any proxy or other shenanigans?

outer mesa
#

The thing is also that discord changed some things about their gateway, we hear more issues with reconnecting like this lately, both for v13 and v14.

outer mesa
#

You already implemented a shardError handler, so you did part of it…

#

What? No

#

catch errors where they happen to keep your bot from crashing. Then djs will reconnect if it can. If your bot crashes without any error/rejection then you either have an error handler that ignores errors instead of handling them or you the process ended regularly meaning the client got destroyed