I'm asking this question because I've noticed that a lot of (if not all) discord bots go offline every few hours, then come back 2 seconds later. After making my own bot, it does the exact same thing (and it's only in 4 servers). Every few hours, it goes offline for 2 seconds then comes back. Does anyone have an explanation as to why this happens?
Debugging
When the problem occurs, it also triggers on_ready(), which seems to me to mean that it isn't discord, but the client.
Other Information

I am using discord.py-rewrite library, but I've seen this happen with the discord.js library as well
This happens in active servers
Unless most bot developers make the same mistake, this is not a problem with my code.
This is not a pressing issue for me. I am just mostly curious why and am not necessarily looking for a solution, though I would appreciate it if you had one.
It could be possible that the Raspberry Pi loses connection to the discord client if it's connected wirelessly to the internet. Mine does the same for other servers unless it's connected through ethernet.
Discord.py bot goes offline repeatedly