From c056709332810408a7677c935d0ac3d3179df944 Mon Sep 17 00:00:00 2001 From: "Nyeki.py" <84998222+Nekidev@users.noreply.github.com> Date: Wed, 23 Oct 2024 15:36:48 -0300 Subject: [PATCH] fix(bot): :bug: Actually hang up calls with `p.shutdown`. --- payphone/cogs/mods/cog.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/payphone/cogs/mods/cog.py b/payphone/cogs/mods/cog.py index effc62b..e7aff61 100644 --- a/payphone/cogs/mods/cog.py +++ b/payphone/cogs/mods/cog.py @@ -294,12 +294,18 @@ class Mods(base.Cog): "⚡ Notified all channels of calls hang up. Flushing messages to the DB..." ) + await redis.delete(constants.CHANNELS_ONCALL_SET) + calls = await models.Call.filter(ended_at=None) call_ids = [call.id for call in calls] if call_ids: await redis.sadd(constants.CALL_IDS_TO_FLUSH, *call_ids) + await models.Call.filter(ended_at=None).update( + ended_at=datetime.now(timezone.utc) + ) + await self.bot.get_cog("Calls").flush_messages(True) await tortoise.Tortoise.close_connections()