Skip to content

optional Options that aren't specified are type Option, not input_type #1366

Closed
@jab416171

Description

@jab416171

Summary

optional Options that aren't specified are type Option, not input_type

Reproduction Steps

Have a method with an optional Option, and try to use its default value

Minimal Reproducible Code

@slash_command(name="roll")
async def roll(self, ctx, sides: int = Option(int, "Number of sides on the die", default=6, min_value=1)):
    """roll a die"""
    print(sides)
    number = random.randint(1, sides)
    await ctx.respond(f"You rolled {number}")

Expected Results

the argument will have a value of "default" and type "input_type" (in the example above, an int with the value 6), not type Option

Actual Results

The argument is of type Option

Intents

all

System Information

  • Python v3.10.4-final
  • py-cord v2.0.0-candidate
    • py-cord pkg_resources: v2.0.0rc1
  • aiohttp v3.8.1
  • system info: Linux 5.17.6-arch1-1 Update README.rst #1 SMP PREEMPT Tue, 10 May 2022 23:00:39 +0000

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.

Additional Context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions