Skip to content

Commit

Permalink
Improve messages
Browse files Browse the repository at this point in the history
  • Loading branch information
fourjr committed Mar 7, 2021
1 parent 31883e6 commit e0956c4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions cogs/modmail.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,13 +606,16 @@ 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."""
message = await ctx.thread.recipient.fetch_message(message_id)
if not message:
try:
message = await ctx.thread.recipient.fetch_message(message_id)
except discord.NotFound:
embed = discord.Embed(
color=self.bot.main_color, description="Message 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)
embed = discord.Embed(
color=self.bot.main_color, description=message.jump_url
)
await ctx.send(embed=embed)

@commands.command()
Expand Down

0 comments on commit e0956c4

Please sign in to comment.