Skip to content

Commit 907b10d

Browse files
committed
Add msglink command to get DM message URLs.
1 parent c5a48f0 commit 907b10d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

cogs/modmail.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,18 @@ async def sfw(self, ctx):
601601
sent_emoji, _ = await self.bot.retrieve_emoji()
602602
await self.bot.add_reaction(ctx.message, sent_emoji)
603603

604+
@commands.command()
605+
@checks.has_permissions(PermissionLevel.SUPPORTER)
606+
@checks.thread_only()
607+
async def loglink(self, ctx, message_id: int):
608+
"""Retrieves the link to a message in the current thread."""
609+
message = await ctx.thread.recipient.fetch_message(message_id)
610+
if not message:
611+
embed = discord.Embed(color=self.bot.main_color, description="Message no longer exists.")
612+
else:
613+
embed = discord.Embed(color=self.bot.main_color, description=message.jump_url)
614+
await ctx.send(embed=embed)
615+
604616
@commands.command()
605617
@checks.has_permissions(PermissionLevel.SUPPORTER)
606618
@checks.thread_only()

0 commit comments

Comments
 (0)