From 7ddbd75899ab4a25396a0b99bc57c16ec698f060 Mon Sep 17 00:00:00 2001 From: Sebastian Kuipers Date: Wed, 17 Apr 2024 13:41:20 +0200 Subject: [PATCH 1/2] msglink command now scans all recipients --- cogs/modmail.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/cogs/modmail.py b/cogs/modmail.py index ee27806177..1a0ebf2c4c 100644 --- a/cogs/modmail.py +++ b/cogs/modmail.py @@ -696,12 +696,18 @@ async def sfw(self, ctx): @checks.thread_only() async def msglink(self, ctx, message_id: int): """Retrieves the link to a message in the current thread.""" - try: - message = await ctx.thread.recipient.fetch_message(message_id) - except discord.NotFound: + found = False + for recipient in ctx.thread.recipients: + try: + message = await recipient.fetch_message(message_id) + found = True + break + except discord.NotFound: + continue + if not found: embed = discord.Embed( - color=self.bot.error_color, description="Message not found or no longer exists." - ) + color=self.bot.error_color, description="Message not found or no longer exists." + ) else: embed = discord.Embed(color=self.bot.main_color, description=message.jump_url) await ctx.send(embed=embed) From d506e6dd3ecdd2bdd309d821bfb3fe8161f11194 Mon Sep 17 00:00:00 2001 From: Sebastian Kuipers Date: Wed, 17 Apr 2024 13:43:32 +0200 Subject: [PATCH 2/2] Run black formatting --- cogs/modmail.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cogs/modmail.py b/cogs/modmail.py index 1a0ebf2c4c..e2a0039384 100644 --- a/cogs/modmail.py +++ b/cogs/modmail.py @@ -706,8 +706,8 @@ async def msglink(self, ctx, message_id: int): continue if not found: embed = discord.Embed( - color=self.bot.error_color, description="Message not found or no longer exists." - ) + color=self.bot.error_color, description="Message not found or no longer exists." + ) else: embed = discord.Embed(color=self.bot.main_color, description=message.jump_url) await ctx.send(embed=embed)