Add __repr__ to Interaction

This commit is contained in:
owocado 2025-01-16 05:31:42 +05:30 committed by GitHub
parent 2c3938dd51
commit 7db391189d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -192,6 +192,9 @@ class Interaction(Generic[ClientT]):
self.command_failed: bool = False
self._from_data(data)
def __repr__(self) -> str:
return f'<{self.__class__.__name__} id={self.id} type={self.type!r} guild_id={self.guild_id!r} user={self.user!r}>'
def _from_data(self, data: InteractionPayload):
self.id: int = int(data['id'])
self.type: InteractionType = try_enum(InteractionType, data['type'])