mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-07-06 18:11:59 +00:00
parent
7cf3cd51a5
commit
50e66d4072
@ -806,6 +806,7 @@ class InteractionResponse:
|
|||||||
attachments: Sequence[Union[Attachment, File]] = MISSING,
|
attachments: Sequence[Union[Attachment, File]] = MISSING,
|
||||||
view: Optional[View] = MISSING,
|
view: Optional[View] = MISSING,
|
||||||
allowed_mentions: Optional[AllowedMentions] = MISSING,
|
allowed_mentions: Optional[AllowedMentions] = MISSING,
|
||||||
|
delete_after: Optional[float] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""|coro|
|
"""|coro|
|
||||||
|
|
||||||
@ -835,6 +836,12 @@ class InteractionResponse:
|
|||||||
allowed_mentions: Optional[:class:`~discord.AllowedMentions`]
|
allowed_mentions: Optional[:class:`~discord.AllowedMentions`]
|
||||||
Controls the mentions being processed in this message. See :meth:`.Message.edit`
|
Controls the mentions being processed in this message. See :meth:`.Message.edit`
|
||||||
for more information.
|
for more information.
|
||||||
|
delete_after: :class:`float`
|
||||||
|
If provided, the number of seconds to wait in the background
|
||||||
|
before deleting the message we just edited. If the deletion fails,
|
||||||
|
then it is silently ignored.
|
||||||
|
|
||||||
|
.. versionadded:: 2.2
|
||||||
|
|
||||||
Raises
|
Raises
|
||||||
-------
|
-------
|
||||||
@ -885,6 +892,17 @@ class InteractionResponse:
|
|||||||
|
|
||||||
self._response_type = InteractionResponseType.message_update
|
self._response_type = InteractionResponseType.message_update
|
||||||
|
|
||||||
|
if delete_after is not None:
|
||||||
|
|
||||||
|
async def inner_call(delay: float = delete_after):
|
||||||
|
await asyncio.sleep(delay)
|
||||||
|
try:
|
||||||
|
await self._parent.delete_original_response()
|
||||||
|
except HTTPException:
|
||||||
|
pass
|
||||||
|
|
||||||
|
asyncio.create_task(inner_call())
|
||||||
|
|
||||||
async def send_modal(self, modal: Modal, /) -> None:
|
async def send_modal(self, modal: Modal, /) -> None:
|
||||||
"""|coro|
|
"""|coro|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user