[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))
|
raise BadArgument('Colour "{}" is invalid.'.format(arg))
|
||||||
return discord.Colour(value=value)
|
return discord.Colour(value=value)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
method = getattr(discord.Colour, arg.replace(' ', '_'), None)
|
arg = arg.replace(' ', '_')
|
||||||
if method is None or not inspect.ismethod(method):
|
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))
|
raise BadArgument('Colour "{}" is invalid.'.format(arg))
|
||||||
return method()
|
return method()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user