Bot not auto reconnecting
See original GitHub issueSummary
So my bot keeps disconnecting from discord every few hours. I’m using the write so it should have automatically reconnected.
Reproduction Steps
I switched from using JSON files for server configuration to database ones(but I’m using asqlite).
Minimal Reproducible Code
Here's the log that shows it disconnecting for no reason:
2021-04-26 16:03:00,616:DEBUG:discord.client: Dispatching event socket_response
2021-04-26 16:03:00,616:DEBUG:discord.client: Dispatching event member_update
2021-04-26 16:03:02,454:INFO:discord.client: Received signal to terminate bot and event loop.
2021-04-26 16:03:02,454:INFO:discord.client: Cleaning up tasks.
2021-04-26 16:03:02,454:INFO:discord.client: Cleaning up after 2 tasks.
2021-04-26 16:03:02,454:INFO:discord.client: All tasks finished cancelling.
2021-04-26 16:03:02,455:INFO:discord.client: Closing the event loop.
Expected Results
I expected the bot to reconnect after disconnecting
Actual Results
It would just stop and never even reconnect
Intents
member and presence
System Information
Python 3.7 Discord.py 1.6.0 Raspberry PI OS on the Raspberry Pi it runs on Windows on my PC
Checklist
- I have searched the open issues for duplicates.
- I have shown the entire traceback, if possible.
- I have removed my token from display, if visible.
Additional Context
I use a Raspberry Pi to keep my bot running, but this issue hasn’t happened before
Issue Analytics
- State:
- Created 2 years ago
- Comments:16 (3 by maintainers)
Top Results From Across the Web
Reconnect bot when it's kicked/disconnected #623 - GitHub
If you attempt to reconnect using the bot with less than 30 seconds between connections, an "invalid credentials" connection will be thrown. I ......
Read more >python - Discord Bot fails to reconnect to voice chat after leaving
one of the usual causes for this is that the context is lost when the bot disconnects, so unless it's saved, it won't...
Read more >[Python] Making a bot auto-reconnect : r/Discord_Bots - Reddit
I'm running a small bot for a server of friends locally, but my internet dcs often for a few seconds and then my...
Read more >[Solved]-How Do I Auto Reconnect my Discord.js Bot-discord.js
A workaround I'm using is to ping the bot (HTTP GET request in my case) every 30 minutes, destroy the client and login...
Read more >How does your company reconnect bot runners to control room?
How do you handle reconnecting bot runners to control room after a restart? Do you have a script that reconnects it? Do you...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That doesn’t seem like a good idea for python programs. Plus, I don’t understand service files, despite the amount of tutorials I watched
Don’t use tmux. Create service file and run as user or root whatever you like.