Handling message being deleted

If the message no longer exists, just return True as if it was deleted.
This commit is contained in:
Fabi Portillo 2021-06-10 00:52:38 -06:00 committed by GitHub
parent 1fc7d52575
commit 9c8ff82170
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,7 +8,11 @@ class Deletion:
async def update(self):
self.remainingTime = self.remainingTime - 1
if (self.remainingTime <= 0):
await self.message.delete()
return True
try:
await self.message.delete()
except Exception as exception:
print(f"Error: {exception}")
finally:
return True
else:
return False