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