diff --git a/mdlink/mdlink.py b/mdlink/mdlink.py index bd6b5e1..3701d11 100644 --- a/mdlink/mdlink.py +++ b/mdlink/mdlink.py @@ -1,4 +1,7 @@ +import typing as t + from discord.ext import commands +from discord.utils import escape_markdown from bot import ModmailBot from core import checks @@ -14,10 +17,19 @@ def __init__(self, bot: ModmailBot): @commands.command() @checks.has_permissions(PermissionLevel.MODERATOR) @checks.thread_only() - async def mdlink(self, ctx: commands.Context, *, text: str = "ModMail") -> None: + async def mdlink( + self, + ctx: commands.Context, + plain: t.Optional[t.Literal["plain", "p", "mobile", "m"]] = None, + *, + text: str = "ModMail", + ) -> None: """Return a link to the modmail thread in markdown syntax.""" link = await self.bot.api.get_log_link(ctx.channel.id) - await ctx.send(f"`[{text}]({link})`") + if plain: + await ctx.send(escape_markdown(f"[{text}]({link})", as_needed=True, ignore_links=False)) + else: + await ctx.send(f"`[{text}]({link})`") async def setup(bot: ModmailBot) -> None: