diff --git a/bot/exts/core/error_handler.py b/bot/exts/core/error_handler.py index ef694f0c2..cf7959e6d 100644 --- a/bot/exts/core/error_handler.py +++ b/bot/exts/core/error_handler.py @@ -1,45 +1,17 @@ -import random -from collections.abc import Iterable - -from discord import Embed, Message from discord.ext import commands from pydis_core.utils.logging import get_logger from bot.bot import Bot -from bot.constants import Colours, ERROR_REPLIES log = get_logger(__name__) -DELETE_DELAY = 10 -QUESTION_MARK_ICON = "https://cdn.discordapp.com/emojis/512367613339369475.png" - - class CommandErrorHandler(commands.Cog): """A error handler for the PythonDiscord server.""" def __init__(self, bot: Bot): self.bot = bot - @staticmethod - def revert_cooldown_counter(command: commands.Command, message: Message) -> None: - """Undoes the last cooldown counter for user-error cases.""" - if command._buckets.valid: - bucket = command._buckets.get_bucket(message) - bucket._tokens = min(bucket.rate, bucket._tokens + 1) - log.debug("Cooldown counter reverted as the command was not used correctly.") - - @staticmethod - def error_embed(message: str, title: Iterable | str = ERROR_REPLIES) -> Embed: - """Build a basic embed with red colour and either a random error title or a title provided.""" - embed = Embed(colour=Colours.soft_red) - if isinstance(title, str): - embed.title = title - else: - embed.title = random.choice(title) - embed.description = message - return embed - @commands.Cog.listener() async def on_command_error(self, ctx: commands.Context, error: commands.CommandError) -> None: """Activates when a command raises an error."""