Browse Source

Fix TypeError in Range transformer from None value

pull/7587/head
Steve C 3 years ago
committed by GitHub
parent
commit
65a1c1014b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      discord/app_commands/transformers.py

8
discord/app_commands/transformers.py

@ -384,7 +384,7 @@ else:
.. code-block:: python3
@app_commands.command()
async def range(interaction: discord.Interaction, value: app_commands.Range[10:12]):
async def range(interaction: discord.Interaction, value: app_commands.Range[int, 10, 12]):
await interaction.response.send_message(f'Your value is {value}', ephemeral=True)
"""
@ -414,7 +414,11 @@ else:
else:
raise TypeError(f'expected int or float as range type, received {obj_type!r} instead')
transformer = _make_range_transformer(opt_type, min=obj_type(min), max=obj_type(max))
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,
)
return _TransformMetadata(transformer)

Loading…
Cancel
Save