aboutsummaryrefslogtreecommitdiff
path: root/discord/ext
diff options
context:
space:
mode:
authorEdwin <[email protected]>2021-03-29 00:38:34 +0200
committerGitHub <[email protected]>2021-03-28 18:38:34 -0400
commit31ee3fafc17c552fa972dfa9bd0fc38915538684 (patch)
tree56abdd0185dd99b5016f972366dbda21cd52d23b /discord/ext
parent[commands] Only remove top level commands on cog load failure (diff)
downloaddiscord.py-31ee3fafc17c552fa972dfa9bd0fc38915538684.tar.xz
discord.py-31ee3fafc17c552fa972dfa9bd0fc38915538684.zip
Add remove_markdown helper function
Diffstat (limited to 'discord/ext')
-rw-r--r--discord/ext/commands/converter.py9
1 files changed, 8 insertions, 1 deletions
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)