aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar S. Co1 <[email protected]>2020-02-23 10:06:19 -0700
committerGravatar GitHub <[email protected]>2020-02-23 10:06:19 -0700
commit0ea0290e895a3c7e1ea7ba84cf483bf3cc38cc43 (patch)
tree65548e51f929cf25199ea5c527ef3d7ab9a65d1e
parentMerge pull request #756 from python-discord/bug/backend/s329/docker-compose-tty (diff)
parentMerge branch 'master' into checkout-msg-log (diff)
Merge pull request #776 from python-discord/checkout-msg-log
Change verification post log level to info, tidy code.
-rw-r--r--bot/cogs/verification.py27
1 files changed, 13 insertions, 14 deletions
diff --git a/bot/cogs/verification.py b/bot/cogs/verification.py
index f13ccd728..582237374 100644
--- a/bot/cogs/verification.py
+++ b/bot/cogs/verification.py
@@ -93,19 +93,21 @@ class Verification(Cog):
ping_everyone=Filter.ping_everyone,
)
- ctx = await self.bot.get_context(message) # type: Context
-
+ ctx: Context = await self.bot.get_context(message)
if ctx.command is not None and ctx.command.name == "accept":
- return # They used the accept command
+ return
- for role in ctx.author.roles:
- if role.id == Roles.verified:
- log.warning(f"{ctx.author} posted '{ctx.message.content}' "
- "in the verification channel, but is already verified.")
- return # They're already verified
+ if any(r.id == Roles.verified for r in ctx.author.roles):
+ log.info(
+ f"{ctx.author} posted '{ctx.message.content}' "
+ "in the verification channel, but is already verified."
+ )
+ return
- log.debug(f"{ctx.author} posted '{ctx.message.content}' in the verification "
- "channel. We are providing instructions how to verify.")
+ log.debug(
+ f"{ctx.author} posted '{ctx.message.content}' in the verification "
+ "channel. We are providing instructions how to verify."
+ )
await ctx.send(
f"{ctx.author.mention} Please type `!accept` to verify that you accept our rules, "
f"and gain access to the rest of the server.",
@@ -113,11 +115,8 @@ class Verification(Cog):
)
log.trace(f"Deleting the message posted by {ctx.author}")
-
- try:
+ with suppress(NotFound):
await ctx.message.delete()
- except NotFound:
- log.trace("No message found, it must have been deleted by another bot.")
@command(name='accept', aliases=('verify', 'verified', 'accepted'), hidden=True)
@without_role(Roles.verified)