mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-19 15:36:02 +00:00
[commands] Raise BadArgument in ColourConverter when using from_hsv/rgb
Fixes #2043
This commit is contained in:
parent
24d3a5a48d
commit
e4de25eaab
@ -298,8 +298,9 @@ class ColourConverter(Converter):
|
||||
raise BadArgument('Colour "{}" is invalid.'.format(arg))
|
||||
return discord.Colour(value=value)
|
||||
except ValueError:
|
||||
method = getattr(discord.Colour, arg.replace(' ', '_'), None)
|
||||
if method is None or not inspect.ismethod(method):
|
||||
arg = arg.replace(' ', '_')
|
||||
method = getattr(discord.Colour, arg, None)
|
||||
if arg.startswith('from_') or method is None or not inspect.ismethod(method):
|
||||
raise BadArgument('Colour "{}" is invalid.'.format(arg))
|
||||
return method()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user