Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Core dependencies
discord.py>=2.3.0
discord.py>=2.4.0
flask>=2.3.0
flask-cors>=4.0.0
python-dotenv>=1.0.0
Expand All @@ -24,6 +24,7 @@ Pillow>=10.0.0
# AI and external services
openai>=1.0.0
anthropic>=0.7.0
stripe>=7.0.0

# Data processing and utilities
pandas>=2.0.0
Expand Down
10 changes: 10 additions & 0 deletions src/cogs/ai/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""AI cogs module."""


async def setup(bot):
"""Setup function for AI cogs."""
from .chat import PerplexityChat
from .server_designer import ServerDesigner

await bot.add_cog(PerplexityChat(bot))
await bot.add_cog(ServerDesigner(bot))
30 changes: 30 additions & 0 deletions src/cogs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,36 @@ async def cog_after_invoke(self, ctx: commands.Context):
# Track command usage if needed
pass

async def cog_app_command_error(
self,
interaction: discord.Interaction,
error: discord.app_commands.AppCommandError
):
"""Handle slash command errors for all cogs that inherit BaseCog."""
self.logger.error(
f"App command error: {type(error).__name__}: {error}",
exc_info=error
)

if isinstance(error, discord.app_commands.CommandOnCooldown):
msg = f"⏰ This command is on cooldown. Try again in {error.retry_after:.1f} seconds."
elif isinstance(error, discord.app_commands.MissingPermissions):
msg = "❌ You don't have permission to use this command."
elif isinstance(error, discord.app_commands.BotMissingPermissions):
msg = "❌ I don't have the required permissions to execute this command."
elif isinstance(error, discord.app_commands.CheckFailure):
msg = str(error) or "❌ You don't meet the requirements for this command."
else:
msg = "❌ An error occurred while executing this command."

try:
if interaction.response.is_done():
await interaction.followup.send(msg, ephemeral=True)
else:
await interaction.response.send_message(msg, ephemeral=True)
except Exception:
pass

async def cog_command_error(self, ctx: commands.Context, error: Exception):
"""Handle cog-specific errors."""
# Log the error
Expand Down
4 changes: 3 additions & 1 deletion src/cogs/community/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ async def setup(bot):
from .leveling import Levelling
from .registration import Register
from .welcome import Welcomer
from .starboard import Starboard
from .game_scraper import GameScraper

await bot.add_cog(AutoRole(bot))
await bot.add_cog(Levelling(bot))
await bot.add_cog(Register(bot))
await bot.add_cog(Welcomer(bot))
await bot.add_cog(Starboard(bot))
await bot.add_cog(GameScraper(bot))
8 changes: 8 additions & 0 deletions src/cogs/custom_commands/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"""Custom commands cogs module."""


async def setup(bot):
"""Setup function for custom commands cog."""
from .manager import CustomCommandsManager

await bot.add_cog(CustomCommandsManager(bot))
Loading
Loading