<commit_before>import asyncio
import logging
import traceback

import discord
from discord.ext import commands

from ..tools import Cog, is_in_channel, is_in_guild

log = logging.getLogger(__name__)


class CommandErrorHandler(Cog):
    @Cog.listener()
    async def on_command_error(self, ctx: commands.Context, error: commands.CommandError):
        """The event triggered when an error is raised while invoking a command."""
        if isinstance(error, commands.CommandNotFound):
            return

        msg = None
        alex = ctx.bot.owner
        if isinstance(error, asyncio.TimeoutError):
            msg = f"timed out. you can start again with {ctx.prefix}{ctx.command}"

        if isinstance(error, commands.MaxConcurrencyReached):
            msg = f"{ctx.command} is currently being ran. please wait for it to finish."

        if isinstance(error, commands.CommandOnCooldown):
            msg = f"{ctx.command} is being used too often, try again later"

        if isinstance(error, commands.DisabledCommand):
            msg = f'{ctx.command} has been disabled.'

        elif isinstance(error, commands.NotOwner):
            msg = f'{ctx.command} is a owner only command.'

        elif isinstance(error, commands.NoPrivateMessage):
            msg = f'{ctx.command} can not be used in Private Messages.'<commit_msg>dawn pls<commit_after>import asyncio
import logging
import traceback
import random

import discord
from discord.ext import commands

from ..tools import Cog, is_in_channel, is_in_guild

log = logging.getLogger(__name__)


class CommandErrorHandler(Cog):
    @Cog.listener()
    async def on_command_error(self, ctx: commands.Context, error: commands.CommandError):
        """The event triggered when an error is raised while invoking a command."""
        if isinstance(error, commands.CommandNotFound):
            return

        msg = None
        alex = ctx.bot.owner
        if isinstance(error, asyncio.TimeoutError):
            msg = f"timed out. you can start again with {ctx.prefix}{ctx.command}"

        if isinstance(error, commands.MaxConcurrencyReached):
            msg = f"{ctx.command} is currently being ran. please wait for it to finish."

        if isinstance(error, commands.CommandOnCooldown):
            if ctx.author.id == 335928292542513162 and random.random < 0.2:
                msg = "DAWN PLS"
            else:
                msg = f"{ctx.command} is being used too often, try again later"

        if isinstance(error, commands.DisabledCommand):
            msg = f'{ctx.command} has been disabled.'

        elif isinstance(error, commands.NotOwner):
            msg = f'{ctx.command} is a owner only command.'

        elif isinstance(error, commands.NoPrivateMessage):
            msg = f'{ctx.command} can not be used in Private Messages.'
{'fraction_non_alphanumeric': 0.08936170212765958, 'fraction_numerical': 0.0070921985815602835, 'mean_word_length': 2.7764390896921016, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1421248', 'n_tokens_mistral': 781, 'n_tokens_neox': 744, 'n_words': 252}