# Path: dozer/cogs/_utils.py
# DOZER_LOGGER = logging.getLogger("dozer")
# class CommandMixin:
# class Command(CommandMixin, commands.Command):
# class Group(CommandMixin, commands.Group):
# class Cog(commands.Cog):
# class Reactor:
# class Paginator(Reactor):
# class PrefixHandler:
# class DynamicPrefixEntry(db.DatabaseTable):
#     def __init__(self, func, **kwargs):
#     def required_permissions(self):
#     def example_usage(self):
#     def example_usage(self, usage):
#     def command(self, *args, **kwargs):
#     def group(self, *args, **kwargs):
# def command(**kwargs):
# def group(**kwargs):
#     def __init__(self, bot):
# def dev_check():
#     async def predicate(ctx):
#     def __init__(self, ctx, initial_reactions, *, auto_remove=True, timeout=60):
#     async def __aiter__(self):
#     def do(self, action):
#     def stop(self):
#     def _check_reaction(self, reaction, member):
#     def __init__(self, ctx, initial_reactions, pages, *, start=0, auto_remove=True, timeout=60):
#     async def __aiter__(self):
#     def go_to_page(self, page):
#     def next(self, amt=1):
#     def prev(self, amt=1):
# async def paginate(ctx, pages, *, start=0, auto_remove=True, timeout=60):
# def chunk(iterable, size):
# def bot_has_permissions(**required):
#     def predicate(ctx):
#     def decorator(func):
#     def __init__(self, default_prefix):
#     def handler(self, bot, message):
#     async def refresh(self):
#     async def initial_create(cls):
#     def __init__(self, guild_id, prefix):
#     async def get_by(cls, **kwargs):


import logging
import re
import sys
import traceback
import discord
from discord.ext import commands
from discord_slash import SlashCommand
from sentry_sdk import capture_exception
from . import utils
from .cogs import _utils

if discord.version_info.major < 1:
    DOZER_LOGGER.error("Your installed discord.py version is too low "
                       "%d.%d.%d, please upgrade to at least 1.0.0a",
                       discord.version_info.major,
                       discord.version_info.minor,
                       discord.version_info.micro)
    sys.exit(1)


class InvalidContext(commands.CheckFailure):
    """
    Check failure raised by the global check for an invalid command context - executed by a bot, exceeding global rate-limit, etc.
    The message will be ignored.
    """


class DozerContext(commands.Context):
    """Cleans all messages before sending"""
    async def send(self, content=None, **kwargs): # pylint: disable=arguments-differ
        if content is not None:
            content = utils.clean(self, content, mass=True, member=False, role=False, channel=False)
        return await super().send(content, **kwargs)


class Dozer(commands.Bot):
    """Botty things that are critical to Dozer working"""
    _global_cooldown = commands.Cooldown(1, 1, commands.BucketType.user)  # One command per second per user

    def __init__(self, config, *args, **kwargs):

# Path: dozer/cogs/_utils.py
# DOZER_LOGGER = logging.getLogger("dozer")
# class CommandMixin:
# class Command(CommandMixin, commands.Command):
# class Group(CommandMixin, commands.Group):
# class Cog(commands.Cog):
# class Reactor:
# class Paginator(Reactor):
# class PrefixHandler:
# class DynamicPrefixEntry(db.DatabaseTable):
#     def __init__(self, func, **kwargs):
#     def required_permissions(self):
#     def example_usage(self):
#     def example_usage(self, usage):
#     def command(self, *args, **kwargs):
#     def group(self, *args, **kwargs):
# def command(**kwargs):
# def group(**kwargs):
#     def __init__(self, bot):
# def dev_check():
#     async def predicate(ctx):
#     def __init__(self, ctx, initial_reactions, *, auto_remove=True, timeout=60):
#     async def __aiter__(self):
#     def do(self, action):
#     def stop(self):
#     def _check_reaction(self, reaction, member):
#     def __init__(self, ctx, initial_reactions, pages, *, start=0, auto_remove=True, timeout=60):
#     async def __aiter__(self):
#     def go_to_page(self, page):
#     def next(self, amt=1):
#     def prev(self, amt=1):
# async def paginate(ctx, pages, *, start=0, auto_remove=True, timeout=60):
# def chunk(iterable, size):
# def bot_has_permissions(**required):
#     def predicate(ctx):
#     def decorator(func):
#     def __init__(self, default_prefix):
#     def handler(self, bot, message):
#     async def refresh(self):
#     async def initial_create(cls):
#     def __init__(self, guild_id, prefix):
#     async def get_by(cls, **kwargs):


# Path: dozer/bot.py
import logging
import re
import sys
import traceback
import discord
from discord.ext import commands
from discord_slash import SlashCommand
from sentry_sdk import capture_exception
from . import utils
from .cogs import _utils


if discord.version_info.major < 1:
    DOZER_LOGGER.error("Your installed discord.py version is too low "
                       "%d.%d.%d, please upgrade to at least 1.0.0a",
                       discord.version_info.major,
                       discord.version_info.minor,
                       discord.version_info.micro)
    sys.exit(1)


class InvalidContext(commands.CheckFailure):
    """
    Check failure raised by the global check for an invalid command context - executed by a bot, exceeding global rate-limit, etc.
    The message will be ignored.
    """


class DozerContext(commands.Context):
    """Cleans all messages before sending"""
    async def send(self, content=None, **kwargs): # pylint: disable=arguments-differ
        if content is not None:
            content = utils.clean(self, content, mass=True, member=False, role=False, channel=False)
        return await super().send(content, **kwargs)


class Dozer(commands.Bot):
    """Botty things that are critical to Dozer working"""
    _global_cooldown = commands.Cooldown(1, 1, commands.BucketType.user)  # One command per second per user

    def __init__(self, config, *args, **kwargs):

        self.dynamic_prefix = _utils.PrefixHandler(config['prefix'])