discord.io
discord.io copied to clipboard
bot.connect() not working in a timeout
Calling bot.connect() in a timeout after the bot has been disconnected doesn't reconnect it back. It can still write messages to the server but not receive.
Not sure if that is the normal behaviour due to the discord protocols, but it can be quite mystic trying to figure out why the bot wasn't reconnecting.
// Automatically reconnect if the bot disconnects due to inactivity
bot.on('disconnect', function(erMsg, code) {
setTimeout(()=>{
bot.connect();
}, 1000);
});
try logging erMsg
and code
, they might give insight into what's going on
also, are you using the community fork or izy's original version?