Skip to content
Merged
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
16 changes: 14 additions & 2 deletions mdlink/mdlink.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
Expand Down