[types] Typing-checking error for commands.hybrid_command()
and app_commands.command()
decorators.
#9788
Labels
unconfirmed bug
A bug report that needs triaging
Summary
Using the
commands.hybrid_command()
andapp_commands.command()
decorators on free functions results in type-checking errors when using attributes of that command (e.g..error
to decorate an error-handling function).Reproduction Steps
I only noticed this after installing discord.py from the GitHub main branch, using a hybrid command on a free function, then using that command's
.error
decorator on another free function. Could be tied to advances in pyright.Minimal Reproducible Code
Expected Results
No complaints from the type-checker on any of the decorated free functions.
Actual Results
Complaints from the type-checker about the hybrid and app commands, about only partially resolving the generic classes
commands.hybrid.HybridCommand
andapp_commands.command.Command
, which proliferates to many of those classes's methods.Intents
N/A: This is related to typing. No bot is instantiated, therefore no Intents were used.
System Information
Checklist
Additional Context
This could potentially be fixed by using the same trick that
commands.command
uses (see below), but I'm not sure how much of a problem it would be to change the bound forCogT
andGroupT
in the files forcommand.hybrid_command
andapp_commands.command
to includeOptional[...]
, and that seems like it would be necessary:discord.py/discord/ext/commands/core.py
Lines 1700 to 1714 in 425edd2
discord.py/discord/ext/commands/core.py
Lines 1728 to 1733 in 425edd2
The text was updated successfully, but these errors were encountered: