diff options
author | 2019-08-13 20:04:10 -0400 | |
---|---|---|
committer | 2019-08-13 20:04:10 -0400 | |
commit | d2a8e1caf351601071f2a96715a7f9d95a1e69fb (patch) | |
tree | 3f94c3c965fc3a4d42b36dafeb9bab6abcaf3462 /bot/seasons/evergreen/error_handler.py | |
parent | Merge pull request #254 from jakeHebert/master (diff) | |
parent | Fix indent style and reduce logging message verbosity (diff) |
Merge pull request #251 from python-discord/seasonalbot-commands
Limit SeasonalBot commands to whitelisted channels
Diffstat (limited to 'bot/seasons/evergreen/error_handler.py')
-rw-r--r-- | bot/seasons/evergreen/error_handler.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/bot/seasons/evergreen/error_handler.py b/bot/seasons/evergreen/error_handler.py index f4457f8f..6690cf89 100644 --- a/bot/seasons/evergreen/error_handler.py +++ b/bot/seasons/evergreen/error_handler.py @@ -1,10 +1,15 @@ import logging
import math
+import random
import sys
import traceback
+from discord import Colour, Embed
from discord.ext import commands
+from bot.constants import NEGATIVE_REPLIES
+from bot.decorators import InChannelCheckFailure
+
log = logging.getLogger(__name__)
@@ -34,6 +39,16 @@ class CommandErrorHandler(commands.Cog): error = getattr(error, 'original', error)
+ if isinstance(error, InChannelCheckFailure):
+ logging.debug(
+ f"{ctx.author} the command '{ctx.command}', but they did not have "
+ f"permissions to run commands in the channel {ctx.channel}!"
+ )
+ embed = Embed(colour=Colour.red())
+ embed.title = random.choice(NEGATIVE_REPLIES)
+ embed.description = str(error)
+ return await ctx.send(embed=embed)
+
if isinstance(error, commands.CommandNotFound):
return logging.debug(
f"{ctx.author} called '{ctx.message.content}' but no command was found."
|