Closed RandomAnimeGamer closed 6 years ago
This is perfectly normal. The connections to Discord's API have an expiry time, and code 1000 shows that your session has reached that time. Or something.
Anyway, it's normal, it happens to everyone, and you should just call bot.connect()
to reconnect your bot when this happens.
Maybe I should clarify why it's not normal then. The bot DMs me when it reconnects, and it seems to have done it inconsistently. Some days it only reconnects once, but other days... well I'll let you figure it out from this screenshot:
Edit: Specifically notice how right as it reconnects, sometimes it actually gets disconnected in the process and reconnects again. Or how it can happen 6 times within a 6-hour interval. I don't think this is normal given some days only get three reconnects or even only one reconnect.
Sorry, I was wrong. It's not because of an expiry time. But I promise: it is normal, and it does happen to everyone.
https://github.com/discordapp/discord-api-docs/issues/211
In that link you'll find a brief discussion which links to a flowchart. In the top-right of the chart you'll see a list of disconnect status codes. 1000 is labelled as "The connection closed gracefully (or the heartbeats timed out". If this happens, simply reconnect.
Ah okay. It is just odd how it disconnects so frequently. Thanks for letting me know about this!
For some reason, my discord.io bot keeps disconnecting with code 1000 (Reason: undefined). I doubt it's my internet connection because I'm using Ethernet and the connection works fine for gaming online.
When programming the bot, I specifically made sure that it only accepts commands from an admin-only channel, most of which it only responds to if the author's user ID is my user ID.
The only other functionality it has is that it gives roles to new members on my server (Currently nobody new has joined since I made the bot) and to DM me when it disconnects, then reconnects.
Is there any reason why my bot keeps on disconnecting? And why would the reason be "undefined"?