Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add msglink command to get DM message URLs. #2964

Merged
merged 5 commits into from
Mar 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions cogs/modmail.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,23 @@ async def sfw(self, ctx):
sent_emoji, _ = await self.bot.retrieve_emoji()
await self.bot.add_reaction(ctx.message, sent_emoji)

@commands.command()
@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:
embed = discord.Embed(
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)

@commands.command()
@checks.has_permissions(PermissionLevel.SUPPORTER)
@checks.thread_only()
Expand Down
6 changes: 5 additions & 1 deletion core/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,11 @@ def _format_info_embed(self, user, log_url, log_count, color):
# embed.add_field(name='Mention', value=user.mention)
# embed.add_field(name='Registered', value=created + days(created))

footer = "User ID: " + str(user.id)
if user.dm_channel:
footer = f"User ID: {user.id} • DM ID: {user.dm_channel}"
else:
footer = f"User ID: {user.id}"

embed.set_author(name=str(user), icon_url=user.avatar_url, url=log_url)
# embed.set_thumbnail(url=avi)

Expand Down