aboutsummaryrefslogtreecommitdiffstats
path: root/bot/seasons/evergreen/error_handler.py
diff options
context:
space:
mode:
authorGravatar kosayoda <[email protected]>2019-08-06 00:39:25 +0800
committerGravatar kosayoda <[email protected]>2019-08-06 00:39:25 +0800
commitef95acda7c8511de52d125d6f355be89984b1bfe (patch)
tree12c4ef87bcec20e01a73470146fb2a334b980f9a /bot/seasons/evergreen/error_handler.py
parentAdd global check to SeasonalBot (diff)
Implement error handling; add `in_channel` overrides to `!issue` and AoC commands
Diffstat (limited to 'bot/seasons/evergreen/error_handler.py')
-rw-r--r--bot/seasons/evergreen/error_handler.py15
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."