Closed elenakrittik closed 1 year ago
Adding the Callable[["CommandInteraction"], MaybeCoro[bool]]
variant to the Check
type solves the issue, though i'm not sure whether that's a correct solution.
Thanks for the bug report, appreciate all the details c:
"are not entirely correct" in #614 refers to things like the @commands.check
decorator, which can be used for both prefix commands and application commands, while only type-checking properly for the former. That being said, this is definitely still an issue.
InteractionBotBase is indeed a defect 🙃
InteractionBotBase is indeed a defect 🙃
It abstracts the entire app command framework into a mixin that can be used together with Client
and/or BotBase
. Although I do agree that it turned out clumsy.
It could be a composite object. Instead of a bunch of subclasses for sharding and commands, a single Bot class could hold a (Sharded)Client, and a container for command managers.
It could be a composite object. Instead of a bunch of subclasses for sharding and commands, a single Bot class could hold a (Sharded)Client, and a container for command managers.
This sounds like a separate issue about refactoring how all these Clients, Bots and *Bases are structured.
Of course, it's not related to this issue.
I'll create an issue for it once I have a half decent idea for it.
Of course, it's not related to this issue.
I'll create an issue for it once I have a half decent idea for it.
Such refactor won't happen before disnake 3.0, so there's no need for a gh issue. Instead we can include it in a list on the /projects tab
Summary
A defect in InteractionBotBase typings causes valid application commands checks-related methods usage to make pyright sad.
Reproduction Steps
I'm using pdm here but this bug is not it's issue; choose whatever PM you prefer.
Reproduction steps:
Minimal Reproducible Code
Expected Results
I expected code to type check properly as the usage is perfectly correct.
Actual Results
Due to wrong typing inside disnake itself code cannot be type checked properly, though at runtime it works flawlessly.
Intents
Intents.default()
but that doesn't matter in this case.System Information
Checklist
Additional Context
I am aware of #614, but there no any mentions about possible downsides of broken typings. The phrasing there is also a bit confusing: "are not entirely correct" does not quite represent application commands methods using types intended for prefix ones (
Check
, specifically). Decorator versions work fine because of# type: ignore
s placed there (as mentioned accordingly in #614), despite for another reason, and are currently the only type-"safe" workaround (a partial workaround, as you still would not be able to remove checks as there isn't a decorator for that).