# 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 json
import logging
import math
import os
import discord
from datetime import timezone, datetime
from dateutil import parser
from discord.ext.commands import has_permissions, BadArgument
from ._utils import *
from .general import blurple
from .. import db
        if not self.started_timers:
            for message in messages:
                task = self.bot.loop.create_task(self.msg_timer(message))
                self.timers[message.request_id] = task
                started += 1
            self.started_timers = True
            DOZER_LOGGER.info(f"Started {started}/{len(messages)} scheduled messages")
        else:
            DOZER_LOGGER.info("Client Resumed: Timers still running")

    async def msg_timer(self, db_entry):
        """Holds the futures for sending a message"""
        delay = db_entry.time - datetime.now(tz=timezone.utc)
        if delay.total_seconds() > 0:
            await asyncio.sleep(delay.total_seconds())
        await self.send_scheduled_msg(db_entry)
        await db_entry.delete(request_id=db_entry.request_id)

    async def send_scheduled_msg(self, db_entry, channel_override=None):
        """Formats and sends scheduled message"""
        embed = discord.Embed(title=db_entry.header if db_entry.header else "Scheduled Message", description=db_entry.content)
        guild = self.bot.get_guild(db_entry.guild_id)
        if not guild:
            DOZER_LOGGER.warning(f"Attempted to schedulesend message in guild({db_entry.guild_id}); Guild no longer exist")
            return
        channel = guild.get_channel(db_entry.channel_id if not channel_override else channel_override)
        if not channel:
            DOZER_LOGGER.warning(f"Attempted to schedulesend message in guild({guild}), channel({db_entry.channel_id});"
                                 f" Channel no longer exist")
            return

# 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/management.py
import asyncio
import json
import logging
import math
import os
import discord
from datetime import timezone, datetime
from dateutil import parser
from discord.ext.commands import has_permissions, BadArgument
from ._utils import *
from .general import blurple
from .. import db

        if not self.started_timers:
            for message in messages:
                task = self.bot.loop.create_task(self.msg_timer(message))
                self.timers[message.request_id] = task
                started += 1
            self.started_timers = True
            DOZER_LOGGER.info(f"Started {started}/{len(messages)} scheduled messages")
        else:
            DOZER_LOGGER.info("Client Resumed: Timers still running")

    async def msg_timer(self, db_entry):
        """Holds the futures for sending a message"""
        delay = db_entry.time - datetime.now(tz=timezone.utc)
        if delay.total_seconds() > 0:
            await asyncio.sleep(delay.total_seconds())
        await self.send_scheduled_msg(db_entry)
        await db_entry.delete(request_id=db_entry.request_id)

    async def send_scheduled_msg(self, db_entry, channel_override=None):
        """Formats and sends scheduled message"""
        embed = discord.Embed(title=db_entry.header if db_entry.header else "Scheduled Message", description=db_entry.content)
        guild = self.bot.get_guild(db_entry.guild_id)
        if not guild:
            DOZER_LOGGER.warning(f"Attempted to schedulesend message in guild({db_entry.guild_id}); Guild no longer exist")
            return
        channel = guild.get_channel(db_entry.channel_id if not channel_override else channel_override)
        if not channel:
            DOZER_LOGGER.warning(f"Attempted to schedulesend message in guild({guild}), channel({db_entry.channel_id});"
                                 f" Channel no longer exist")
            return

        embed.colour = blurple