From 80408b02d172a5c95328255da44d3349ebaea64a Mon Sep 17 00:00:00 2001 From: Rafael Bradley <84998222+Nekidev@users.noreply.github.com> Date: Sat, 26 Oct 2024 14:38:09 -0300 Subject: [PATCH] feat(bot): Stop heartbeat when shard disconnects from Discord. --- payphone/bot.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/payphone/bot.py b/payphone/bot.py index 65ab2b6..73e91a9 100644 --- a/payphone/bot.py +++ b/payphone/bot.py @@ -124,6 +124,9 @@ class Payphone(commands.AutoShardedBot): print(f"Shard {shard_id} was resumed!") + async def on_shard_disconnect(shard_id: int) -> None: + self.update_heartbeat.cancel() + async def get_or_fetch_channel( self, channel_id: int ) -> abc.GuildChannel | abc.PrivateChannel | discord.Thread | None: