# 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
                embed.set_footer(text=f"Page {page_num + 1} of {math.ceil(len(messages) / 3)}")
        await paginate(ctx, pages)

    list.example_usage = """
    `{prefix}schedulesend list`: Lists all scheduled messages for the current guild
    """


class ScheduledMessages(db.DatabaseTable):
    """Stores messages that are scheduled to be sent"""
    __tablename__ = 'scheduled_messages'
    __uniques__ = 'entry_id, request_id'

    @classmethod
    async def initial_create(cls):
        """Create the table in the database"""
        async with db.Pool.acquire() as conn:
            await conn.execute(f"""
            CREATE TABLE {cls.__tablename__} (
            entry_id serial,
            request_id bigint UNIQUE NOT NULL, 
            guild_id bigint NOT NULL,
            channel_id bigint NOT NULL,
            requester_id bigint NULL, 
            time timestamptz NOT NULL,
            header text NULL,
            content text NOT NULL,
            PRIMARY KEY (entry_id, request_id)
            )""")


# 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

                embed.set_footer(text=f"Page {page_num + 1} of {math.ceil(len(messages) / 3)}")
        await paginate(ctx, pages)

    list.example_usage = """
    `{prefix}schedulesend list`: Lists all scheduled messages for the current guild
    """


class ScheduledMessages(db.DatabaseTable):
    """Stores messages that are scheduled to be sent"""
    __tablename__ = 'scheduled_messages'
    __uniques__ = 'entry_id, request_id'

    @classmethod
    async def initial_create(cls):
        """Create the table in the database"""
        async with db.Pool.acquire() as conn:
            await conn.execute(f"""
            CREATE TABLE {cls.__tablename__} (
            entry_id serial,
            request_id bigint UNIQUE NOT NULL, 
            guild_id bigint NOT NULL,
            channel_id bigint NOT NULL,
            requester_id bigint NULL, 
            time timestamptz NOT NULL,
            header text NULL,
            content text NOT NULL,
            PRIMARY KEY (entry_id, request_id)
            )""")


    def __init__(self, guild_id, channel_id, time, content, request_id, header=None, requester_id=None, entry_id=None):