refactor: Improve webhook typing.#1193
refactor: Improve webhook typing.#1193elenakrittik wants to merge 9 commits intoDisnakeDev:masterfrom
Conversation
shiftinv
left a comment
There was a problem hiding this comment.
Thanks for the PR! c:
It's not quite clear whether this is meant to be a typing or runtime change; followup is annotated as returning an InteractionFollowupWebhook, but returns a "plain" Webhook in practice.
Types that are only used in annotations can be confusing to some people, so it might be better to actually use this type at runtime too?
As a more general comment: having to subclass something to change a return type annotation for specific situations is rather awkward. I can't think of another solution either, other than maybe generics, which wouldn't help much iac.
Making it actually return an |
ah, gotcha. 🤔 |
That's a nice idea, thanks! |
|
Done in ec9a610! |
This is why those situations should be working on distinct types. Not a subclass of one handle-all type, as it later shows the interface allows for more than is actually supported. |
So you suggest something like making |
I suggest making |
Yeah. A bunch of the class/instance methods on |
Summary
Fixes #626
This is a typing-breaking change.
Should
Webhook.editandWebhook.deletealso be overloaded with aNeversomewhere to forbid calling them (you can't delete or edit an interaction webhook, right?)?Checklist
pdm lintpdm pyright