Add delay kwarg to message.delete()

Refactor delete_after kwargs to use new delay kwarg
This commit is contained in:
Vexs
2019-04-17 17:50:50 -05:00
committed by Rapptz
parent f38b199d6a
commit 0f48b78987
2 changed files with 20 additions and 17 deletions

View File

@ -784,13 +784,7 @@ class Messageable(metaclass=abc.ABCMeta):
ret = state.create_message(channel=channel, data=data)
if delete_after is not None:
async def delete():
await asyncio.sleep(delete_after, loop=state.loop)
try:
await ret.delete()
except HTTPException:
pass
asyncio.ensure_future(delete(), loop=state.loop)
await ret.delete(delay=delete_after)
return ret
async def trigger_typing(self):