Added (back?) support for hexes without #...
for ColourConverter Technically, this never was a documented feature in d.py, but ColourConverter used to work without a # Is this worth a versionchanged? I'll let other contributors decide
This commit is contained in:
parent
3ffe134895
commit
4baf615cd4
@ -597,7 +597,8 @@ class ColourConverter(Converter[discord.Colour]):
|
|||||||
Add an alias named ColorConverter
|
Add an alias named ColorConverter
|
||||||
|
|
||||||
The following formats are accepted:
|
The following formats are accepted:
|
||||||
|
|
||||||
|
- ``<hex>``
|
||||||
- ``0x<hex>``
|
- ``0x<hex>``
|
||||||
- ``#<hex>``
|
- ``#<hex>``
|
||||||
- ``0x#<hex>``
|
- ``0x#<hex>``
|
||||||
@ -668,7 +669,9 @@ class ColourConverter(Converter[discord.Colour]):
|
|||||||
|
|
||||||
arg = arg.replace(' ', '_')
|
arg = arg.replace(' ', '_')
|
||||||
method = getattr(discord.Colour, arg, None)
|
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)
|
raise BadColourArgument(arg)
|
||||||
return method()
|
return method()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user