File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -1312,6 +1312,7 @@ async def send(
1312
1312
view : View = MISSING ,
1313
1313
thread : Snowflake = MISSING ,
1314
1314
wait : bool = False ,
1315
+ delete_after : float = None ,
1315
1316
) -> Optional [WebhookMessage ]:
1316
1317
"""|coro|
1317
1318
@@ -1377,6 +1378,9 @@ async def send(
1377
1378
The thread to send this webhook to.
1378
1379
1379
1380
.. versionadded:: 2.0
1381
+ delete_after: :class:`float`
1382
+ If provided, the number of seconds to wait in the background
1383
+ before deleting the message we just sent.
1380
1384
1381
1385
Raises
1382
1386
--------
@@ -1459,6 +1463,12 @@ async def send(
1459
1463
message_id = None if msg is None else msg .id
1460
1464
self ._state .store_view (view , message_id )
1461
1465
1466
+ if delete_after is not None :
1467
+ async def delete ():
1468
+ await asyncio .sleep (delete_after )
1469
+ await msg .delete ()
1470
+ asyncio .ensure_future (delete (), loop = self ._state .loop )
1471
+
1462
1472
return msg
1463
1473
1464
1474
async def fetch_message (
You can’t perform that action at this time.
0 commit comments