diff --git a/discord/app_commands/transformers.py b/discord/app_commands/transformers.py index bf3998b78..8a9d6af70 100644 --- a/discord/app_commands/transformers.py +++ b/discord/app_commands/transformers.py @@ -492,10 +492,15 @@ else: else: raise TypeError(f'expected int, float, or str as range type, received {obj_type!r} instead') + if obj_type in (str, int): + cast = int + else: + cast = float + transformer = _make_range_transformer( opt_type, - min=obj_type(min) if min is not None else None, - max=obj_type(max) if max is not None else None, + min=cast(min) if min is not None else None, + max=cast(max) if max is not None else None, ) return _TransformMetadata(transformer)