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)