diff --git a/payphone/cogs/calls/cog.py b/payphone/cogs/calls/cog.py index f1e0ac2..25140a3 100644 --- a/payphone/cogs/calls/cog.py +++ b/payphone/cogs/calls/cog.py @@ -327,18 +327,23 @@ class Calls(base.Cog): channel = find(lambda c: c.id == channel_id, call.channels) other_channel = find(lambda c: c.id != channel_id, call.channels) - other_channel.call = None - await other_channel.save() + if other_channel is not None: + other_channel.call = None + await other_channel.save() - try: - await self.bot.get_partial_messageable(other_channel.id).send( - f"☎️ {secrets.choice(constants.MSGS_PHONE_HANGUP_YOU)}" - ) - except errors.DiscordException: - pass + try: + await self.bot.get_partial_messageable(other_channel.id).send( + f"☎️ {secrets.choice(constants.MSGS_PHONE_HANGUP_YOU)}" + ) + except errors.DiscordException: + pass await redis.srem( - constants.CHANNELS_ONCALL_SET, str(channel_id), str(other_channel.id) + constants.CHANNELS_ONCALL_SET, + *( + [str(channel_id)] + + ([str(other_channel.id)] if other_channel is not None else []) + ), ) last_channel_calls = [