-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Here's my current idea for the design:
class StaticComponents(StaticComponentIDsEnum):
Private_Thing: StaticComponentID[int] = 1
@staticComponentCallback(StaticComponents.Private_Thing)
async def showHelpPageStatic(self, interaction: Interaction, userId: str): # type checker error: (Self, Interaction, str) -> Coroutine is not compatible with (Self, Interaction, int) -> Coroutine
...
userId = "abc"
privateThingButton = StaticComponents.PrivateThing(Button(), userId) # type checker error: no overload (Button, str) found, expected (ComponentBase, int)The StaticComponentID hint should be generic in a ParamSpec. It can then Concatenate with self and interaction types to get the expected callback signature, and with the discord component base class to get the component constructor signature.
Remember that some callbacks don't accept any parameters.
If it's easier, we could use a descriptor instead of a type hint. That way the static component ID would also be aware of its name.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request