Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
raidensakura committed Apr 21, 2024
1 parent 514bd51 commit 67c0cc8
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions cogs/modmail.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,14 +693,20 @@ async def sfw(self, ctx):
sent_emoji, _ = await self.bot.retrieve_emoji()
await self.bot.add_reaction(ctx.message, sent_emoji)

@commands.command()
@commands.command(name="msglink", aliases=["messagelink"])
@checks.has_permissions(PermissionLevel.SUPPORTER)
@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."
)
Expand Down

0 comments on commit 67c0cc8

Please sign in to comment.