From 67bc58c1cc50fdf479274f4eb3e9f394363a7e6d Mon Sep 17 00:00:00 2001 From: bast Date: Fri, 25 Sep 2020 12:16:12 -0700 Subject: Make .bm handle embed-suppression syntax for message links [link] and [] are also supported --- bot/utils/converters.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 bot/utils/converters.py (limited to 'bot/utils') diff --git a/bot/utils/converters.py b/bot/utils/converters.py new file mode 100644 index 00000000..74a0b5b7 --- /dev/null +++ b/bot/utils/converters.py @@ -0,0 +1,15 @@ +import discord + +from discord.ext.commands.converter import MessageConverter + + +class BetterMessageConverter(MessageConverter): + """A converter that handles embed-suppressed links like """ + async def convert(self, ctx, argument: str) -> discord.Message: + # It's possible to wrap a message in [<>] as well, and it's supported because its easy + if argument.startswith("[") and argument.endswith("]"): + argument = argument[1:-1] + if argument.startswith("<") and argument.endswith(">"): + argument = argument[1:-1] + + return await super().convert(ctx, argument) -- cgit v1.2.3