Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions interactions/client/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,28 @@ async def has_permissions(
else:
return any(perm in self.author.permissions for perm in permissions)

async def delete(self) -> None:
"""
This deletes the interaction response of a message sent by
the contextually derived information from this class.

.. note::
Doing this will proceed in the context message no longer
being present.
"""
if self.responded and self.message is not None:
await self._client.delete_interaction_response(
application_id=str(self.application_id),
token=self.token,
message_id=int(self.message.id),
)
else:
await self._client.delete_interaction_response(
application_id=str(self.application_id), token=self.token
)

self.message = None


@define()
class CommandContext(_Context):
Expand Down Expand Up @@ -613,28 +635,6 @@ async def send(self, content: Optional[str] = MISSING, **kwargs) -> Message:
author={"_client": self._client, "id": None, "username": None, "discriminator": None},
)

async def delete(self) -> None:
"""
This deletes the interaction response of a message sent by
the contextually derived information from this class.

.. note::
Doing this will proceed in the context message no longer
being present.
"""
if self.responded and self.message is not None:
await self._client.delete_interaction_response(
application_id=str(self.application_id),
token=self.token,
message_id=int(self.message.id),
)
else:
await self._client.delete_interaction_response(
application_id=str(self.application_id), token=self.token
)

self.message = None

async def populate(self, choices: Union[Choice, List[Choice]]) -> List[Choice]:
"""
This "populates" the list of choices that the client-end
Expand Down