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
|
|
@ -2,6 +2,12 @@ from modules.base_module import BaseModule
|
|||
from datetime import datetime, timedelta
|
||||
import asyncio
|
||||
import json
|
||||
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 ConnectionMonitor(BaseModule):
|
||||
|
|
@ -186,9 +192,7 @@ class ConnectionMonitor(BaseModule):
|
|||
|
||||
async def _is_admin(self, nickname):
|
||||
"""Check if user has admin privileges."""
|
||||
# This should match the admin system in other modules
|
||||
admin_users = ["admin", "megaproxy", "megasconed"]
|
||||
return nickname.lower() in admin_users
|
||||
return nickname.lower() == ADMIN_USER.lower()
|
||||
|
||||
async def get_connection_health(self):
|
||||
"""Get connection health status for monitoring."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue