First layout

This commit is contained in:
2026-06-17 12:33:19 -05:00
parent 2e91115a1e
commit cfff3e7366
10 changed files with 1531 additions and 1 deletions

106
cogs/config.py Normal file
View File

@@ -0,0 +1,106 @@
import discord
from discord.ext import commands
import os
class Config(commands.Cog):
def __init__(self, bot):
self.bot = bot
async def is_bot_owner(self, ctx):
"""Check if user is bot owner"""
return ctx.author.id == self.bot.owner_id or await self.bot.is_owner(ctx.author)
@commands.command(name='reload')
async def reload(self, ctx):
"""Reload all cogs (owner only)"""
if not await self.is_bot_owner(ctx):
await ctx.send('❌ You don\'t have permission to use this command.')
return
cogs_dir = 'cogs'
reloaded = []
failed = []
for filename in os.listdir(cogs_dir):
if filename.endswith('.py') and not filename.startswith('_'):
cog_name = filename[:-3]
try:
await self.bot.reload_extension(f'cogs.{cog_name}')
reloaded.append(cog_name)
except Exception as e:
failed.append(f'{cog_name}: {str(e)}')
embed = discord.Embed(
title='🔄 Cog Reload',
color=discord.Color.green() if not failed else discord.Color.orange()
)
if reloaded:
embed.add_field(
name='✅ Reloaded',
value=', '.join(reloaded),
inline=False
)
if failed:
embed.add_field(
name='❌ Failed',
value='\n'.join(failed),
inline=False
)
await ctx.send(embed=embed)
@commands.command(name='debug')
async def debug(self, ctx):
"""Show debug information (owner only)"""
if not await self.is_bot_owner(ctx):
await ctx.send('❌ You don\'t have permission to use this command.')
return
embed = discord.Embed(
title='🔧 Debug Info',
color=discord.Color.blue()
)
embed.add_field(
name='Bot ID',
value=str(self.bot.user.id),
inline=True
)
embed.add_field(
name='Latency',
value=f'{self.bot.latency * 1000:.2f}ms',
inline=True
)
embed.add_field(
name='Guilds',
value=str(len(self.bot.guilds)),
inline=True
)
embed.add_field(
name='Cogs Loaded',
value=str(len(self.bot.cogs)),
inline=True
)
if hasattr(self.bot, 'db') and self.bot.db:
embed.add_field(
name='Database',
value='✅ Connected',
inline=True
)
else:
embed.add_field(
name='Database',
value='❌ Not connected',
inline=True
)
await ctx.send(embed=embed)
async def setup(bot):
await bot.add_cog(Config(bot))