blob: 228714c9829bcab6b251620072dcfa962daa2a3e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
import discord
from discord.ext.commands.converter import MessageConverter
class WrappedMessageConverter(MessageConverter):
"""A converter that handles embed-suppressed links like <http://example.com>."""
async def convert(self, ctx: discord.ext.commands.Context, argument: str) -> discord.Message:
"""Wrap the commands.MessageConverter to handle <> delimited message links."""
# 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)
|