diff --git a/discord/interactions.py b/discord/interactions.py index b1efe92dc..a77889c95 100644 --- a/discord/interactions.py +++ b/discord/interactions.py @@ -685,12 +685,15 @@ class InteractionCallback: 'message_id', ) - def __init__(self, *, data: InteractionCallbackPayload, state: ConnectionState) -> None: + def __init__(self, *, data: InteractionCallbackResponsePayload, state: ConnectionState) -> None: self._state: ConnectionState = state self.id: int = int(data['id']) self._message: Optional[Message] = None self._update(data) + def __repr__(self) -> str: + return f'' + def _update(self, data: InteractionCallbackResponsePayload) -> None: self.type: InteractionType = try_enum(InteractionType, data['type']) self.activity_instance_id: Optional[str] = data.get('activity_instance_id') @@ -756,8 +759,6 @@ class InteractionCallbackResource(Generic[ClientT]): except KeyError: pass - self._parent.response._message = self.message - class InteractionCallbackResponse(Generic[ClientT]): """Represents a Discord response to an interaction. @@ -792,14 +793,14 @@ class InteractionCallbackResponse(Generic[ClientT]): self.resource: Optional[InteractionCallbackResource] = None def __repr__(self) -> str: - return f'' + return f'' def _update(self, data: InteractionCallbackPayload) -> None: interaction = data['interaction'] resource = data.get('resource', {}) self.interaction._update(interaction) if self.resource: - self.resource._update(resource) + self.resource._update(resource) # pyright: ignore[reportArgumentType] else: self.resource = InteractionCallbackResource(data=resource, state=self._state, parent=self) # type: ignore @@ -1213,7 +1214,7 @@ class InteractionResponse(Generic[ClientT]): delete_after: Optional[float] = None, suppress_embeds: bool = MISSING, with_response: bool = True, - ) -> Optional[InteractionCallback[ClientT]]: + ) -> Optional[InteractionCallbackResponse[ClientT]]: """|coro| Responds to this interaction by editing the original message of diff --git a/discord/types/interactions.py b/discord/types/interactions.py index c41e55c83..3f3516c3a 100644 --- a/discord/types/interactions.py +++ b/discord/types/interactions.py @@ -333,5 +333,5 @@ class InteractionCallbackResource(TypedDict): class InteractionCallback(TypedDict): - interaction: InteractionCallback + interaction: InteractionCallbackResponse resource: NotRequired[InteractionCallbackResource]