Skip to content
This repository has been archived by the owner on Mar 25, 2020. It is now read-only.

bot.connect() not working in a timeout #273

Open
Smiche opened this issue Jun 8, 2018 · 1 comment
Open

bot.connect() not working in a timeout #273

Smiche opened this issue Jun 8, 2018 · 1 comment

Comments

@Smiche
Copy link

Smiche commented Jun 8, 2018

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);
});
@cloudrac3r
Copy link

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants