Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Dec 26, 2022. It is now read-only.
This repository was archived by the owner on Dec 26, 2022. It is now read-only.

Support for Optional[...] in CommandArg #302

@Sigmanificient

Description

@Sigmanificient

trying to use
CommandArg[Optional[str], Description["..."]] = None
raises

Traceback (most recent call last):
  File "/home/sigmanificient/PycharmProjects/Pincers/Pincer/dev/context.py", line 8, in <module>
    class Bot(Client):
  File "/home/sigmanificient/PycharmProjects/Pincers/Pincer/dev/context.py", line 10, in Bot
    async def a_command(
  File "/home/sigmanificient/PycharmProjects/Pincers/Pincer/pincer/commands/commands.py", line 237, in command
    command_type = _options_type_link[annotation.command_type]
KeyError: typing.Union[str, **NoneType]

the "working" way to do it is the following:

    async def a_command(
        self,
        ctx: MessageContext,
        content: CommandArg[str, Description["..."]] = None,
    ) -> Embed:

But this doesnt seems really fine as None doesn't seems to be typed.
The first argument should be Optional[str]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions