# Path: dozer/cogs/general.py
# class General(Cog):
#     async def ping(self, ctx):
#     async def base_help(self, ctx, *target):
#     async def _help_all(self, ctx):
#     async def _help_command(self, ctx, command):
#     async def _help_cog(self, ctx, cog):
#     async def _show_help(self, ctx, start_page, title, description, footer, commands, **format_args):
#     async def nick(self, ctx, *, nicktochangeto):
#     async def invite(self, ctx):
#     async def configprefix(self, ctx, prefix: str):
# def setup(bot):


import asyncio
import datetime
import logging
import re
import time
import typing
import discord
from logging import getLogger
from typing import Union
from discord.ext import tasks
from discord.ext.commands import BadArgument, has_permissions, RoleConverter, guild_only
from ._utils import *
from .general import blurple
from .. import db
            msg = await ctx.message.channel.fetch_message(num)
            deleted = await ctx.message.channel.purge(after=msg, limit=MAX_PURGE, check=check_target)
            await ctx.send(
                f"Deleted {len(deleted)} messages under request of {ctx.message.author.mention}",
                delete_after=5)
        except discord.NotFound:
            if num > MAX_PURGE:
                await ctx.send("Message cannot be found or you're trying to purge too many messages.")
                return
            deleted = await ctx.message.channel.purge(limit=num + 1, check=check_target)
            await ctx.send(
                f"Deleted {len(deleted) - 1} messages under request of {ctx.message.author.mention}",
                delete_after=5)

    prune.example_usage = """
    `{prefix}prune 10` - Delete the last 10 messages in the current channel.
    `{prefix}prune 786324930378727484` - Deletes all messages up to that message ID
    """

    @command()
    @guild_only()
    @has_permissions(manage_roles=True)
    async def punishments(self, ctx):
        """List currently active mutes and deafens in a guild"""
        punishments = await PunishmentTimerRecords.get_by(guild_id=ctx.guild.id)
        deafen_records = await Deafen.get_by(guild_id=ctx.guild.id)
        self_inflicted = [record.member_id for record in deafen_records if record.self_inflicted]
        deafens = [punishment for punishment in punishments if punishment.type_of_punishment == 2 and punishment.target_id not in self_inflicted]
        self_deafens = [punishment for punishment in punishments if punishment.type_of_punishment == 2 and punishment.target_id in self_inflicted]
        mutes = [punishment for punishment in punishments if punishment.type_of_punishment == 1]

# Path: dozer/cogs/general.py
# class General(Cog):
#     async def ping(self, ctx):
#     async def base_help(self, ctx, *target):
#     async def _help_all(self, ctx):
#     async def _help_command(self, ctx, command):
#     async def _help_cog(self, ctx, cog):
#     async def _show_help(self, ctx, start_page, title, description, footer, commands, **format_args):
#     async def nick(self, ctx, *, nicktochangeto):
#     async def invite(self, ctx):
#     async def configprefix(self, ctx, prefix: str):
# def setup(bot):


# Path: dozer/cogs/moderation.py
import asyncio
import datetime
import logging
import re
import time
import typing
import discord
from logging import getLogger
from typing import Union
from discord.ext import tasks
from discord.ext.commands import BadArgument, has_permissions, RoleConverter, guild_only
from ._utils import *
from .general import blurple
from .. import db

            msg = await ctx.message.channel.fetch_message(num)
            deleted = await ctx.message.channel.purge(after=msg, limit=MAX_PURGE, check=check_target)
            await ctx.send(
                f"Deleted {len(deleted)} messages under request of {ctx.message.author.mention}",
                delete_after=5)
        except discord.NotFound:
            if num > MAX_PURGE:
                await ctx.send("Message cannot be found or you're trying to purge too many messages.")
                return
            deleted = await ctx.message.channel.purge(limit=num + 1, check=check_target)
            await ctx.send(
                f"Deleted {len(deleted) - 1} messages under request of {ctx.message.author.mention}",
                delete_after=5)

    prune.example_usage = """
    `{prefix}prune 10` - Delete the last 10 messages in the current channel.
    `{prefix}prune 786324930378727484` - Deletes all messages up to that message ID
    """

    @command()
    @guild_only()
    @has_permissions(manage_roles=True)
    async def punishments(self, ctx):
        """List currently active mutes and deafens in a guild"""
        punishments = await PunishmentTimerRecords.get_by(guild_id=ctx.guild.id)
        deafen_records = await Deafen.get_by(guild_id=ctx.guild.id)
        self_inflicted = [record.member_id for record in deafen_records if record.self_inflicted]
        deafens = [punishment for punishment in punishments if punishment.type_of_punishment == 2 and punishment.target_id not in self_inflicted]
        self_deafens = [punishment for punishment in punishments if punishment.type_of_punishment == 2 and punishment.target_id in self_inflicted]
        mutes = [punishment for punishment in punishments if punishment.type_of_punishment == 1]

        embed = discord.Embed(title=f"Active punishments in {ctx.guild}", color=blurple)