aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Gareth Coles <[email protected]>2018-06-05 18:04:17 +0100
committerGravatar Gareth Coles <[email protected]>2018-06-05 18:04:31 +0100
commit99ba4eea17e41c13b3989d7ca6e35863c895739e (patch)
tree06c09a46671a3141009d054b638683f5a2a4d7cc
parentremove deploy.py [ci skip] (diff)
[Verification] Don't break if another bot removed the message
-rw-r--r--bot/cogs/verification.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/bot/cogs/verification.py b/bot/cogs/verification.py
index 83a31c15a..d9e27d652 100644
--- a/bot/cogs/verification.py
+++ b/bot/cogs/verification.py
@@ -1,6 +1,6 @@
import logging
-from discord import Message, Object
+from discord import Message, Object, NotFound
from discord.ext.commands import Bot, Context, command
from bot.constants import Channels, Roles
@@ -42,7 +42,11 @@ class Verification:
)
log.trace(f"Deleting the message posted by {ctx.author}")
- await ctx.message.delete()
+
+ try:
+ await ctx.message.delete()
+ except NotFound:
+ log.trace("No message found, it must have been deleted by another bot.")
@command(name="accept", hidden=True, aliases=["verify", "verified", "accepted", "accept()"])
@without_role(Roles.verified)
@@ -56,7 +60,11 @@ class Verification:
await ctx.author.add_roles(Object(Roles.verified), reason="Accepted the rules")
log.trace(f"Deleting the message posted by {ctx.author}.")
- await ctx.message.delete()
+
+ try:
+ await ctx.message.delete()
+ except NotFound:
+ log.trace("No message found, it must have been deleted by another bot.")
def setup(bot):