How do I send a message when my bot disconnects?

Viewed 744

I am quite new to Discord.js, and I would love to know how I can send a message whenever my Discord bot randomly disconnects. It may not be possible due to it being unpredictable... and basic logic, but if so, I would like to know how to do it. I am planning to use this for unexpected disconnects, not intentional disconnects through commands.

1 Answers

You can't send message if disconnection is unexpected, however you can make it send message if you're the one who disconnects the bot.

channel.send('Disconnecting...') .then(msg => client.destroy());

Related