Validate Range to disallow min > max

This commit is contained in:
Rapptz
2022-07-03 07:37:48 -04:00
parent c61e407b50
commit fd9c244f48
2 changed files with 6 additions and 0 deletions

View File

@ -1081,6 +1081,9 @@ else:
self.min: Optional[Union[int, float]] = min
self.max: Optional[Union[int, float]] = max
if min and max and min > max:
raise TypeError('minimum cannot be larger than maximum')
async def convert(self, ctx: Context[BotT], value: str) -> Union[int, float]:
count = converted = self.annotation(value)
if self.annotation is str: