feat(interactions): InteractionResponse Model

This commit is contained in:
Victor Kotlin 2022-08-01 11:48:02 +03:00
parent 7344d96d87
commit 240025351d

View file

@ -78,6 +78,36 @@ class InteractionCallbackType(IntEnum):
return self.value return self.value
class InteractionResponse(APIModelBase):
"""Interaction Response
Attributes
----------
type: InteractionType
The type of response
data: Optional[Any]
An optional response message
"""
type: InteractionCallbackType
data: Optional[Any]
@classmethod
def from_dict(cls, data: Dict[str, Any]) -> InteractionResponse:
"""Generate a InteractionResponse from the given data.
Parameters
----------
data: :class:`dict`
The dictionary to convert into a InteractionResponse.
"""
self: InteractionResponse = super().__new__(cls)
self.type = try_enum(InteractionCallbackType, data["type"])
self.data = data.get("data", None)
return self
@dataclass(repr=False) @dataclass(repr=False)
class Interaction(APIModelBase): class Interaction(APIModelBase):
"""Interaction """Interaction