feat(interactions): delete_original_message() method

This commit is contained in:
Victor Kotlin 2022-08-02 18:30:10 +03:00
parent 9365b18ea2
commit 2822a32a90
2 changed files with 26 additions and 1 deletions

View file

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

View file

@ -134,6 +134,25 @@ class RESTApp:
return Message.from_dict(data) return Message.from_dict(data)
async def delete_original_interaction_response(
self, application_id: Union[Snowflake, str, int], interaction_token: str
) -> Message:
"""|coro|
[**REST API**] Delete Original Interaction Response.
Parameters
----------
application_id : Union[:class:`~melisa.utils.snowflake.Snowflake`, str, int]
Id of interaction to fetch
interaction_token: str
Interaction token
"""
await self._http.delete(
f"/webhooks/{application_id}/{interaction_token}/messages/@original"
)
async def delete_message( async def delete_message(
self, self,
channel_id: Union[Snowflake, str, int], channel_id: Union[Snowflake, str, int],