Added (back?) support for hexes without a prefix for commands.ColourConverter
#52
@ -597,7 +597,8 @@ class ColourConverter(Converter[discord.Colour]):
|
||||
Add an alias named ColorConverter
|
||||
|
||||
The following formats are accepted:
|
||||
|
||||
|
||||
- ``<hex>``
|
||||
- ``0x<hex>``
|
||||
- ``#<hex>``
|
||||
- ``0x#<hex>``
|
||||
@ -668,7 +669,9 @@ class ColourConverter(Converter[discord.Colour]):
|
||||
|
||||
arg = arg.replace(' ', '_')
|
||||
method = getattr(discord.Colour, arg, None)
|
||||
if arg.startswith('from_') or method is None or not inspect.ismethod(method):
|
||||
if method is None:
|
||||
return self.parse_hex_number(argument)
|
||||
elif arg.startswith('from_') or not inspect.ismethod(method):
|
||||
raise BadColourArgument(arg)
|
||||
return method()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user