From b6c3da6963b5a6af94c76c8f1f2fff5c7fa7280b Mon Sep 17 00:00:00 2001 From: Rafael Bradley Date: Sun, 16 Mar 2025 23:33:34 -0300 Subject: [PATCH] perf(shard): :zap: Remove duplicate `set_search()` call in `CallManager.hangup()`. --- payphone/bot.py | 5 +---- payphone/cogs/calls/cog.py | 18 +++++++++--------- payphone/core/calls.py | 1 - 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/payphone/bot.py b/payphone/bot.py index a97d279..30ce2c4 100644 --- a/payphone/bot.py +++ b/payphone/bot.py @@ -126,10 +126,7 @@ class Payphone(commands.AutoShardedBot): try: return await self.fetch_channel(channel_id) - except discord.errors.NotFound: - return None - - except discord.errors.Forbidden: + except (discord.errors.Forbidden, discord.errors.NotFound): return None return channel diff --git a/payphone/cogs/calls/cog.py b/payphone/cogs/calls/cog.py index 148a7cf..4820e52 100644 --- a/payphone/cogs/calls/cog.py +++ b/payphone/cogs/calls/cog.py @@ -270,8 +270,8 @@ class Calls(base.Cog): else: return await message.channel.send( - "💖 Stickers and GIFs are only allowed to donators! You can become one at [our Ko-Fi " - "page]()." + "💖 Stickers and GIFs are only allowed to donators! You can become one at [our " + "Ko-Fi page]()." ) if message.attachments: @@ -288,9 +288,8 @@ class Calls(base.Cog): if not message_content: return - - else: - has_sent_attachments = True + + has_sent_attachments = True embeds = [] @@ -325,7 +324,8 @@ class Calls(base.Cog): replied_message = None await self.bot.get_partial_messageable(other_channel).send( - "❌ **Payphone** is missing permissions to read messages from this channel. Make sure it's got `Read Message History` permissions." + "❌ **Payphone** is missing permissions to read messages from this " + "channel. Make sure it's got `Read Message History` permissions." ) if replied_message is not None: @@ -381,7 +381,7 @@ class Calls(base.Cog): footer=random.choice( [ discord.EmbedFooter( - text="You can also become a supporter at our Ko-Fi page." + text="Become a supporter at our Ko-Fi page!" ) ] + [None] * 3 @@ -517,8 +517,8 @@ class Calls(base.Cog): await self.bot.get_partial_messageable(payload.channel_id).send( ( f"❌ **{payload.data["member"]["nick"] or payload.data["member"]["user"]["global_name"] or payload.data["member"]["user"]["username"]}** " - f"your message wasn't sent because it contained a blocked message or " - "pattern: `{blocked_section}`\n-# Payphone doesn't have read message history " + "your message wasn't sent because it contained a blocked message or " + f"pattern: `{blocked_section}`\n-# Payphone doesn't have read message history " "permission? Make sure to keep that one enabled." ), delete_after=10, diff --git a/payphone/core/calls.py b/payphone/core/calls.py index b869323..f3bbc8e 100644 --- a/payphone/core/calls.py +++ b/payphone/core/calls.py @@ -482,7 +482,6 @@ class CallHandler: if call_id is None: # Channel is searching. - await self.set_searching(channel_id, False) return (channel_id,) channels = [