feat(interactions): fetch_original_message() method

This commit is contained in:
Victor Kotlin 2022-08-02 18:26:48 +03:00
parent 4012a047cb
commit 9365b18ea2
2 changed files with 27 additions and 0 deletions

View file

@ -373,6 +373,12 @@ class Interaction(APIModelBase):
) )
) )
async def fetch_original_message(self) -> Message:
"""Fetch Original Interaction Response from the Discord API."""
return await self._client.rest.get_original_interaction_response(
self.application_id, self.token
)
@dataclass(repr=False) @dataclass(repr=False)
class ResolvedData(APIModelBase): class ResolvedData(APIModelBase):

View file

@ -113,6 +113,27 @@ class RESTApp:
return _choose_channel_type(data) return _choose_channel_type(data)
async def get_original_interaction_response(
self, application_id: Union[Snowflake, str, int], interaction_token: str
) -> Message:
"""|coro|
[**REST API**] Fetch Original Interaction Response from the Discord API.
Parameters
----------
application_id : Union[:class:`~melisa.utils.snowflake.Snowflake`, str, int]
Id of interaction to fetch
interaction_token: str
Interaction token
"""
data = await self._http.get(
f"/webhooks/{application_id}/{interaction_token}/messages/@original"
)
return Message.from_dict(data)
async def delete_message( async def delete_message(
self, self,
channel_id: Union[Snowflake, str, int], channel_id: Union[Snowflake, str, int],