From c4df5a31e78c47262aa72638bd3013748e6dba77 Mon Sep 17 00:00:00 2001 From: Rafael Bradley Date: Sun, 16 Mar 2025 11:04:42 -0300 Subject: [PATCH] fix(shard): :bug: Fix not found error in `get_or_fetch_channel()`. --- payphone/bot.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/payphone/bot.py b/payphone/bot.py index c5cd37b..37af3f2 100644 --- a/payphone/bot.py +++ b/payphone/bot.py @@ -123,7 +123,11 @@ class Payphone(commands.AutoShardedBot): channel = self.get_channel(channel_id) if channel is None: - return await self.fetch_channel(channel_id) + try: + return await self.fetch_channel(channel_id) + + except discord.errors.NotFound: + return None return channel @@ -221,14 +225,10 @@ class Payphone(commands.AutoShardedBot): ) for mention in message.role_mentions: - content = content.replace( - f"<@{mention.id}>", f"@**{mention.name}**" - ) + content = content.replace(f"<@{mention.id}>", f"@**{mention.name}**") for mention in message.channel_mentions: - content = content.replace( - f"<@{mention.id}>", f"#**{mention.name}**" - ) + content = content.replace(f"<@{mention.id}>", f"#**{mention.name}**") return content