From 27a528577b5f36b7ecaaaea440f07335ce952ec9 Mon Sep 17 00:00:00 2001 From: "Nyeki.py" <84998222+Nekidev@users.noreply.github.com> Date: Fri, 25 Oct 2024 23:21:17 -0300 Subject: [PATCH] fix(bot): :bug: Hangup not working. --- payphone/cogs/calls/cog.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/payphone/cogs/calls/cog.py b/payphone/cogs/calls/cog.py index e714fec..ee1bcc0 100644 --- a/payphone/cogs/calls/cog.py +++ b/payphone/cogs/calls/cog.py @@ -483,9 +483,17 @@ class Calls(base.Cog): if is_on_call: channel = await dbutils.get_channel(ctx.channel) - call = await models.Call.get(id=channel.call_id).prefetch_related( - "channels" - ) + try: + call = await models.Call.get(id=channel.call_id).prefetch_related( + "channels" + ) + + except exceptions.DoesNotExist: + await self.bot.redis.srem(constants.CHANNELS_ONCALL_SET, channel_id) + + await ctx.send(f"☎️ {secrets.choice(constants.MSGS_PHONE_HANGUP_ME)}") + + return await self.bot.redis.sadd(constants.CALL_IDS_TO_FLUSH, call.id)