Clean up IRC command architecture and eliminate redundancy
Major cleanup of the modular command system: **Legacy Code Removal:** - Removed all legacy command handlers from src/bot.py (74 lines) - Eliminated outdated command implementations superseded by modular system - Maintained backward compatibility while cleaning up codebase **Duplicate Command Consolidation:** - Removed duplicate status/uptime/ping commands from admin.py - Kept comprehensive implementations in connection_monitor.py - Eliminated 3 redundant commands and ~70 lines of duplicate code **Admin System Standardization:** - Updated backup_commands.py to use central ADMIN_USER from config.py - Updated connection_monitor.py to use central ADMIN_USER from config.py - Removed hardcoded admin user lists across modules - Ensured consistent admin privilege checking system-wide **Benefits:** - Cleaner, more maintainable command structure - No duplicate functionality across modules - Consistent admin configuration management - Reduced codebase size while maintaining all functionality - Better separation of concerns in modular architecture This cleanup addresses technical debt identified in the command audit and prepares the codebase for future development. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
5293da2921
commit
86902c6b83
4 changed files with 27 additions and 180 deletions
|
|
@ -3,6 +3,12 @@ from src.backup_manager import BackupManager, BackupScheduler
|
|||
import asyncio
|
||||
import logging
|
||||
from datetime import datetime
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Add parent directory to path for config import
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
from config import ADMIN_USER
|
||||
|
||||
|
||||
class BackupCommands(BaseModule):
|
||||
|
|
@ -53,10 +59,7 @@ class BackupCommands(BaseModule):
|
|||
|
||||
async def _is_admin(self, nickname):
|
||||
"""Check if user has admin privileges."""
|
||||
# This should be implemented based on your admin system
|
||||
# For now, using a simple check - replace with actual admin verification
|
||||
admin_users = ["admin", "megaproxy"] # Add your admin usernames
|
||||
return nickname.lower() in admin_users
|
||||
return nickname.lower() == ADMIN_USER.lower()
|
||||
|
||||
async def cmd_backup(self, channel, nickname, args):
|
||||
"""Create a manual backup."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue