# Path: dozer/cogs/levels.py
# class MemberXP(db.DatabaseTable):
#     """Database table mapping a guild and user to their XP and related values."""
#     __tablename__ = "levels_member_xp"
#     __uniques__ = "guild_id, user_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__} (
#             guild_id bigint NOT NULL,
#             user_id bigint NOT NULL,
#             total_xp bigint NOT NULL,
#             total_messages int NOT NULL,
#             last_given_at timestamptz NOT NULL,
#             PRIMARY KEY (guild_id, user_id)
#             )""")
# 
#     def __init__(self, guild_id, user_id, total_xp, total_messages, last_given_at):
#         super().__init__()
#         self.guild_id = guild_id
#         self.user_id = user_id
#         self.total_xp = total_xp
#         self.total_messages = total_messages
#         self.last_given_at = last_given_at
# 
#     @classmethod
#     async def get_by(cls, **kwargs):
#         results = await super().get_by(**kwargs)
#         result_list = []
#         for result in results:
#             obj = MemberXP(guild_id=result.get("guild_id"), user_id=result.get("user_id"),
#                            total_xp=result.get("total_xp"), total_messages=result.get("total_messages"),
#                            last_given_at=result.get("last_given_at"))
#             result_list.append(obj)
#         return result_list
# 
# class GuildXPSettings(db.DatabaseTable):
#     """Database table containing per-guild settings related to XP gain."""
#     __tablename__ = "levels_guild_settings"
#     __uniques__ = "guild_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__} (
#             guild_id bigint PRIMARY KEY NOT NULL,
#             xp_min int NOT NULL,
#             xp_max int NOT NULL,
#             xp_cooldown int NOT NULL,
#             entropy_value int NOT NULL,
#             lvl_up_msgs bigint NOT NULL,
#             enabled boolean NOT NULL
#             )""")
# 
#     def __init__(self, guild_id, xp_min, xp_max, xp_cooldown, entropy_value, enabled, lvl_up_msgs, keep_old_roles):
#         super().__init__()
#         self.guild_id = guild_id
#         self.xp_min = xp_min
#         self.xp_max = xp_max
#         self.xp_cooldown = xp_cooldown
#         self.entropy_value = entropy_value
#         self.enabled = enabled
#         self.lvl_up_msgs = lvl_up_msgs
#         self.keep_old_roles = keep_old_roles
# 
#     @classmethod
#     async def get_by(cls, **kwargs):
#         results = await super().get_by(**kwargs)
#         result_list = []
#         for result in results:
#             obj = GuildXPSettings(guild_id=result.get("guild_id"), xp_min=result.get("xp_min"), xp_max=result.get("xp_max"),
#                                   xp_cooldown=result.get("xp_cooldown"), entropy_value=result.get("entropy_value"), enabled=result.get("enabled"),
#                                   lvl_up_msgs=result.get("lvl_up_msgs"), keep_old_roles=result.get("keep_old_roles"))
#             result_list.append(obj)
#         return result_list
# 
#     async def version_1(self):
#         """DB migration v1"""
#         async with db.Pool.acquire() as conn:
#             await conn.execute(f"""
#             ALTER TABLE {self.__tablename__} ALTER COLUMN lvl_up_msgs DROP NOT NULL;
#             ALTER TABLE {self.__tablename__} ADD COLUMN IF NOT EXISTS keep_old_roles boolean NOT NULL default TRUE;
#             """)
# 
#     __versions__ = [version_1]


import math
import typing
import discord
import humanize
from datetime import timezone, datetime
from difflib import SequenceMatcher
from discord.ext.commands import cooldown, BucketType, guild_only
from discord_slash import cog_ext, SlashContext
from ._utils import *
from .levels import MemberXP, GuildXPSettings

        if not levels_enabled:
            embed.add_field(name="Last Seen Here At", value="Levels Disabled")
        elif len(levels_data):
            embed.add_field(name="Last Seen Here At", value=levels_data[0].last_given_at.strftime(datetime_format))
            footers.append(f"Tracked Messages: {levels_data[0].total_messages}")
        else:
            embed.add_field(name="Last Seen Here At", value="Not available")
            footers.append("Tracked Messages: N/A")

        embed.add_field(name='Member Joined', value=member.joined_at.strftime(datetime_format), inline=True)
        if member.premium_since is not None:
            embed.add_field(name='Member Boosted', value=member.premium_since.strftime(datetime_format), inline=True)

        status = 'DND' if member.status is discord.Status.dnd else member.status.name.title()
        if member.status is not discord.Status.offline:
            platforms = self.pluralize([platform for platform in ('web', 'desktop', 'mobile') if
                                        getattr(member, f'{platform}_status') is not discord.Status.offline])
            status = f'{status} on {platforms}'
        activities = '\n'.join(self._format_activities(member.activities))
        if self.bot.config['presences_intents']:
            embed.add_field(name='Status and Activity', value=f'{status}\n{activities}', inline=False)
        for field_number, roles in enumerate(chunk(member.roles[:0:-1], 35)):
            embed.add_field(name='Roles', value=', '.join(role.mention for role in roles) or 'None', inline=False)
        footers.append(f"Color: {str(member.color).upper()}")
        embed.set_footer(text="; ".join(footers))
        await ctx.send(embed=embed)

    member.example_usage = """
    `{prefix}member`: show your member info

# Path: dozer/cogs/levels.py
# class MemberXP(db.DatabaseTable):
#     """Database table mapping a guild and user to their XP and related values."""
#     __tablename__ = "levels_member_xp"
#     __uniques__ = "guild_id, user_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__} (
#             guild_id bigint NOT NULL,
#             user_id bigint NOT NULL,
#             total_xp bigint NOT NULL,
#             total_messages int NOT NULL,
#             last_given_at timestamptz NOT NULL,
#             PRIMARY KEY (guild_id, user_id)
#             )""")
# 
#     def __init__(self, guild_id, user_id, total_xp, total_messages, last_given_at):
#         super().__init__()
#         self.guild_id = guild_id
#         self.user_id = user_id
#         self.total_xp = total_xp
#         self.total_messages = total_messages
#         self.last_given_at = last_given_at
# 
#     @classmethod
#     async def get_by(cls, **kwargs):
#         results = await super().get_by(**kwargs)
#         result_list = []
#         for result in results:
#             obj = MemberXP(guild_id=result.get("guild_id"), user_id=result.get("user_id"),
#                            total_xp=result.get("total_xp"), total_messages=result.get("total_messages"),
#                            last_given_at=result.get("last_given_at"))
#             result_list.append(obj)
#         return result_list
# 
# class GuildXPSettings(db.DatabaseTable):
#     """Database table containing per-guild settings related to XP gain."""
#     __tablename__ = "levels_guild_settings"
#     __uniques__ = "guild_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__} (
#             guild_id bigint PRIMARY KEY NOT NULL,
#             xp_min int NOT NULL,
#             xp_max int NOT NULL,
#             xp_cooldown int NOT NULL,
#             entropy_value int NOT NULL,
#             lvl_up_msgs bigint NOT NULL,
#             enabled boolean NOT NULL
#             )""")
# 
#     def __init__(self, guild_id, xp_min, xp_max, xp_cooldown, entropy_value, enabled, lvl_up_msgs, keep_old_roles):
#         super().__init__()
#         self.guild_id = guild_id
#         self.xp_min = xp_min
#         self.xp_max = xp_max
#         self.xp_cooldown = xp_cooldown
#         self.entropy_value = entropy_value
#         self.enabled = enabled
#         self.lvl_up_msgs = lvl_up_msgs
#         self.keep_old_roles = keep_old_roles
# 
#     @classmethod
#     async def get_by(cls, **kwargs):
#         results = await super().get_by(**kwargs)
#         result_list = []
#         for result in results:
#             obj = GuildXPSettings(guild_id=result.get("guild_id"), xp_min=result.get("xp_min"), xp_max=result.get("xp_max"),
#                                   xp_cooldown=result.get("xp_cooldown"), entropy_value=result.get("entropy_value"), enabled=result.get("enabled"),
#                                   lvl_up_msgs=result.get("lvl_up_msgs"), keep_old_roles=result.get("keep_old_roles"))
#             result_list.append(obj)
#         return result_list
# 
#     async def version_1(self):
#         """DB migration v1"""
#         async with db.Pool.acquire() as conn:
#             await conn.execute(f"""
#             ALTER TABLE {self.__tablename__} ALTER COLUMN lvl_up_msgs DROP NOT NULL;
#             ALTER TABLE {self.__tablename__} ADD COLUMN IF NOT EXISTS keep_old_roles boolean NOT NULL default TRUE;
#             """)
# 
#     __versions__ = [version_1]


# Path: dozer/cogs/info.py
import math
import typing
import discord
import humanize
from datetime import timezone, datetime
from difflib import SequenceMatcher
from discord.ext.commands import cooldown, BucketType, guild_only
from discord_slash import cog_ext, SlashContext
from ._utils import *
from .levels import MemberXP, GuildXPSettings


        if not levels_enabled:
            embed.add_field(name="Last Seen Here At", value="Levels Disabled")
        elif len(levels_data):
            embed.add_field(name="Last Seen Here At", value=levels_data[0].last_given_at.strftime(datetime_format))
            footers.append(f"Tracked Messages: {levels_data[0].total_messages}")
        else:
            embed.add_field(name="Last Seen Here At", value="Not available")
            footers.append("Tracked Messages: N/A")

        embed.add_field(name='Member Joined', value=member.joined_at.strftime(datetime_format), inline=True)
        if member.premium_since is not None:
            embed.add_field(name='Member Boosted', value=member.premium_since.strftime(datetime_format), inline=True)

        status = 'DND' if member.status is discord.Status.dnd else member.status.name.title()
        if member.status is not discord.Status.offline:
            platforms = self.pluralize([platform for platform in ('web', 'desktop', 'mobile') if
                                        getattr(member, f'{platform}_status') is not discord.Status.offline])
            status = f'{status} on {platforms}'
        activities = '\n'.join(self._format_activities(member.activities))
        if self.bot.config['presences_intents']:
            embed.add_field(name='Status and Activity', value=f'{status}\n{activities}', inline=False)
        for field_number, roles in enumerate(chunk(member.roles[:0:-1], 35)):
            embed.add_field(name='Roles', value=', '.join(role.mention for role in roles) or 'None', inline=False)
        footers.append(f"Color: {str(member.color).upper()}")
        embed.set_footer(text="; ".join(footers))
        await ctx.send(embed=embed)

    member.example_usage = """
    `{prefix}member`: show your member info

    `{prefix}member {ctx.me}`: show my member info