diff options
| -rw-r--r-- | bot/__init__.py | 2 | ||||
| -rw-r--r-- | bot/cogs/verification.py | 21 | ||||
| -rw-r--r-- | bot/pagination.py | 2 |
3 files changed, 11 insertions, 14 deletions
diff --git a/bot/__init__.py b/bot/__init__.py index 90ab3c348..f7a410706 100644 --- a/bot/__init__.py +++ b/bot/__init__.py @@ -42,4 +42,4 @@ root_log.addHandler(file_handler) logging.getLogger("discord").setLevel(logging.WARNING) logging.getLogger("websockets").setLevel(logging.WARNING) -logging.getLogger(__name__).setLevel(TRACE_LEVEL) +logging.getLogger(__name__) diff --git a/bot/cogs/verification.py b/bot/cogs/verification.py index 988e0d49a..f13ccd728 100644 --- a/bot/cogs/verification.py +++ b/bot/cogs/verification.py @@ -1,7 +1,8 @@ import logging +from contextlib import suppress from datetime import datetime -from discord import Colour, Message, NotFound, Object +from discord import Colour, Forbidden, Message, NotFound, Object from discord.ext import tasks from discord.ext.commands import Cog, Context, command @@ -127,17 +128,13 @@ class Verification(Cog): await ctx.author.add_roles(Object(Roles.verified), reason="Accepted the rules") try: await ctx.author.send(WELCOME_MESSAGE) - except Exception: - # Catch the exception, in case they have DMs off or something - log.exception(f"Unable to send welcome message to user {ctx.author}.") - - log.trace(f"Deleting the message posted by {ctx.author}.") - - try: - self.mod_log.ignore(Event.message_delete, ctx.message.id) - await ctx.message.delete() - except NotFound: - log.trace("No message found, it must have been deleted by another bot.") + except Forbidden: + log.info(f"Sending welcome message failed for {ctx.author}.") + finally: + log.trace(f"Deleting accept message by {ctx.author}.") + with suppress(NotFound): + self.mod_log.ignore(Event.message_delete, ctx.message.id) + await ctx.message.delete() @command(name='subscribe') @in_channel(Channels.bot) diff --git a/bot/pagination.py b/bot/pagination.py index b6525c2d0..90c8f849c 100644 --- a/bot/pagination.py +++ b/bot/pagination.py @@ -15,7 +15,7 @@ RIGHT_EMOJI = "\u27A1" # [:arrow_right:] LAST_EMOJI = "\u23ED" # [:track_next:] DELETE_EMOJI = constants.Emojis.trashcan # [:trashcan:] -PAGINATION_EMOJI = [FIRST_EMOJI, LEFT_EMOJI, RIGHT_EMOJI, LAST_EMOJI, DELETE_EMOJI] +PAGINATION_EMOJI = (FIRST_EMOJI, LEFT_EMOJI, RIGHT_EMOJI, LAST_EMOJI, DELETE_EMOJI) log = logging.getLogger(__name__) |