def ranged(low, high=None, *, type=int):
'Converter to check if an argument is in a certain range INCLUSIVELY'
if high is None:
low, high = 0, low
def ranged_argument(arg):
result = type(arg)
if low <= result <= high:
return result
raise commands.BadArgument(f'Value must be between {low} and {high}, '
f'or equal to {low} or {high}.')
return ranged_argument
评论列表
文章目录