mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-21 00:07:51 +00:00
[commands] ColourConverter raises if value is out of range
changes make the `ext.commands.ColourConverter` Converter fail when user input is outside the acceptable value range 0x000000 - 0xFFFFFF
This commit is contained in:
parent
2ce42b5b50
commit
d221ca5f7d
@ -294,6 +294,8 @@ class ColourConverter(Converter):
|
||||
arg = arg[1:]
|
||||
try:
|
||||
value = int(arg, base=16)
|
||||
if not (0 <= value <= 0xFFFFFF):
|
||||
raise BadArgument('Colour "{}" is invalid.'.format(arg))
|
||||
return discord.Colour(value=value)
|
||||
except ValueError:
|
||||
method = getattr(discord.Colour, arg.replace(' ', '_'), None)
|
||||
|
Loading…
x
Reference in New Issue
Block a user