From 31ee3fafc17c552fa972dfa9bd0fc38915538684 Mon Sep 17 00:00:00 2001 From: Edwin <60476129+Edwinexd@users.noreply.github.com> Date: Mon, 29 Mar 2021 00:38:34 +0200 Subject: Add remove_markdown helper function --- discord/ext/commands/converter.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'discord/ext') diff --git a/discord/ext/commands/converter.py b/discord/ext/commands/converter.py index 850ca728..2da0e110 100644 --- a/discord/ext/commands/converter.py +++ b/discord/ext/commands/converter.py @@ -676,11 +676,16 @@ class clean_content(Converter): Whether to use nicknames when transforming mentions. escape_markdown: :class:`bool` Whether to also escape special markdown characters. + remove_markdown: :class:`bool` + Whether to also remove special markdown characters. This option is not supported with ``escape_markdown`` + + .. versionadded:: 1.7 """ - def __init__(self, *, fix_channel_mentions=False, use_nicknames=True, escape_markdown=False): + def __init__(self, *, fix_channel_mentions=False, use_nicknames=True, escape_markdown=False, remove_markdown=False): self.fix_channel_mentions = fix_channel_mentions self.use_nicknames = use_nicknames self.escape_markdown = escape_markdown + self.remove_markdown = remove_markdown async def convert(self, ctx, argument): message = ctx.message @@ -731,6 +736,8 @@ class clean_content(Converter): if self.escape_markdown: result = discord.utils.escape_markdown(result) + elif self.remove_markdown: + result = discord.utils.remove_markdown(result) # Completely ensure no mentions escape: return discord.utils.escape_mentions(result) -- cgit v1.2.3