blob: 74a0b5b77ac72e96adf08843335050b5b3c0a5d0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
import discord
from discord.ext.commands.converter import MessageConverter
class BetterMessageConverter(MessageConverter):
"""A converter that handles embed-suppressed links like <http://example.com>"""
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)
|