diff options
-rw-r--r-- | teleport/teleport.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/teleport/teleport.py b/teleport/teleport.py index 2f4b5a6..a4c8100 100644 --- a/teleport/teleport.py +++ b/teleport/teleport.py @@ -1,6 +1,6 @@ import discord from redbot.core import commands - +import redbot.core class Teleport(commands.Cog): def __init__(self, bot): @@ -12,6 +12,8 @@ class Teleport(commands.Cog): self, ctx: commands.GuildContext, destination: discord.abc.GuildChannel | discord.Thread, + *, + reason: str | None ): if isinstance(destination, discord.Thread): parent = destination.parent @@ -29,20 +31,22 @@ class Teleport(commands.Cog): await ctx.react_quietly("❌") return - portal_to_template = "Portal opened to {dest}\n*(done by {user})*" + formatted_reason = redbot.core.utils.chat_formatting.italics(reason) if reason else "" + + portal_to_template = "Portal opened to {dest}" f" : {formatted_reason}\n*(done by {ctx.author.mention})*" source_message = await ctx.send( portal_to_template.format( - dest=destination.mention, user=ctx.author.mention + dest=destination.mention ), allowed_mentions=discord.AllowedMentions.none(), ) dest_message = await destination.send( - f"Portal opened from {source_message.jump_url}\n*(done by {ctx.author.mention})*", + f"Portal opened from {source_message.jump_url} : {formatted_reason}\n*(done by {ctx.author.mention})*", allowed_mentions=discord.AllowedMentions.none(), ) await source_message.edit( content=portal_to_template.format( - dest=dest_message.jump_url, user=ctx.author.mention + dest=dest_message.jump_url ), allowed_mentions=discord.AllowedMentions.none(), ) |