Add comprehensive admin-managed help system for league documentation, resources, FAQs, and guides. Replaces planned /links command with a more flexible and powerful solution. Features: - Full CRUD operations via Discord commands (/help, /help-create, /help-edit, /help-delete, /help-list) - Permission-based access control (admins + Help Editor role) - Markdown-formatted content with category organization - View tracking and analytics - Soft delete with restore capability - Full audit trail (creator, editor, timestamps) - Autocomplete for topic discovery - Interactive modals and paginated list views Implementation: - New models/help_command.py with Pydantic validation - New services/help_commands_service.py with full CRUD API integration - New views/help_commands.py with interactive modals and views - New commands/help/ package with command handlers - Comprehensive README.md documentation in commands/help/ - Test coverage for models and services Configuration: - Added HELP_EDITOR_ROLE_NAME constant to constants.py - Updated bot.py to load help commands - Updated PRE_LAUNCH_ROADMAP.md to mark system as complete - Updated CLAUDE.md documentation Requires database migration for help_commands table. See .claude/DATABASE_MIGRATION_HELP_COMMANDS.md for details. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
50 lines
1.4 KiB
Python
50 lines
1.4 KiB
Python
"""
|
|
Help Commands package for Discord Bot v2.0
|
|
|
|
Modern slash command system for admin-created help topics.
|
|
"""
|
|
import logging
|
|
from typing import List, Tuple, Type
|
|
|
|
from discord.ext import commands
|
|
|
|
from .main import HelpCommands
|
|
|
|
logger = logging.getLogger(f'{__name__}.setup_help_commands')
|
|
|
|
|
|
async def setup_help_commands(bot: commands.Bot) -> Tuple[int, int, List[str]]:
|
|
"""
|
|
Set up help commands command modules.
|
|
|
|
Returns:
|
|
Tuple of (successful_loads, failed_loads, failed_modules)
|
|
"""
|
|
help_command_cogs: List[Tuple[str, Type[commands.Cog]]] = [
|
|
("HelpCommands", HelpCommands),
|
|
]
|
|
|
|
successful = 0
|
|
failed = 0
|
|
failed_modules = []
|
|
|
|
for cog_name, cog_class in help_command_cogs:
|
|
try:
|
|
await bot.add_cog(cog_class(bot))
|
|
logger.info(f"✅ Loaded help commands module: {cog_name}")
|
|
successful += 1
|
|
except Exception as e:
|
|
logger.error(f"❌ Failed to load help commands module {cog_name}: {e}")
|
|
failed += 1
|
|
failed_modules.append(cog_name)
|
|
|
|
# Log summary
|
|
if failed == 0:
|
|
logger.info(f"🎉 All {successful} help commands modules loaded successfully")
|
|
else:
|
|
logger.warning(f"⚠️ Help commands loaded with issues: {successful} successful, {failed} failed")
|
|
if failed_modules:
|
|
logger.warning(f"Failed modules: {', '.join(failed_modules)}")
|
|
|
|
return successful, failed, failed_modules
|