core/types.py - Contains shared interfaces and types
queue/types.py - Contains queue-specific types
Components now depend on interfaces rather than concrete implementations
Broke cyclic dependencies:
Removed direct imports between queue_processor.py and manager.py
Removed circular dependencies between core and processor modules
Components now communicate through well-defined interfaces
Improved architecture:
Clear separation of concerns
Better dependency management
More maintainable and testable code
Proper use of dependency injection
Updated base.py to use absolute imports
Updated cleanup.py to use absolute imports
Updated events.py to use absolute imports
Updated error_handler.py to use absolute imports
Updated guild.py to use absolute imports
Updated initialization.py to use absolute imports
Updated lifecycle.py to use absolute imports
Updated response_handler.py to use absolute imports
Updated settings.py to use absolute imports
In the core/commands module:
Updated archiver_commands.py to use absolute imports
Updated database_commands.py to use absolute imports
Updated settings_commands.py to use absolute imports
Left init.py unchanged as its relative imports are appropriate
In the processor module:
Updated core.py to use absolute imports
Updated processor/init.py to use absolute imports
Updated queue_handler.py to use absolute imports
Updated queue_processor.py to use absolute imports
Updated status_display.py to use absolute imports
Updated cleanup_manager.py to use absolute imports
- Remove unused imports (Union, List)
- Add redbot.core.commands import
- Move core.settings import to top of local imports
- Group imports by standard library, discord, and local modules
- Improve import organization for better readability
- Remove unused imports (Tuple, Union)
- Add redbot.core.commands import
- Group imports by standard library, discord, and local modules
- Improve import organization for better readability
- Add missing redbot.core.commands import
- Organize imports into standard library, discord, and local groups
- Fix CommandContext.__aenter__ to use self.ctx instead of global ctx
- Add pathlib.Path import for download_path usage
- Add Dict, Any, Optional from typing for better type hints
- Organize imports according to best practices
Updated all files to import REACTIONS from constants.py instead of reactions.py:
queue_processor.py
message_handler.py
reactions.py (now only contains reaction handling functions)
events.py (now imports REACTIONS from constants.py and handle_archived_reaction from reactions.py)
core.py
queue_handler.py
processor/init.py
archiver: Main bot control commands
settings: Configuration commands
archivedb: Database management commands
Consistent decorator order across all commands:
@group.command() or @hybrid_group()
@guild_only()
@admin_or_permissions() (where needed)
@app_commands.describe() (for parameters)
Proper parameter descriptions using app_commands.describe for better slash command integration
Added process_queue method to EnhancedVideoQueueManager and updated its initialization
Updated component_manager.py to use EnhancedVideoQueueManager correctly
Fixed circular imports in the core module by:
Moving initialization logic to lifecycle.py
Making initialization.py provide thin wrappers that delegate to lifecycle.py
Ensuring proper import order in base.py
Verified all module init.py files are properly exposing their components:
core/init.py exposes VideoArchiver
queue/init.py exposes EnhancedVideoQueueManager and dependencies
processor/init.py exposes VideoProcessor and related components
commands/init.py exposes command setup functions
The import chain is now clean:
base.py imports from lifecycle.py
lifecycle.py contains all initialization logic
initialization.py delegates to lifecycle.py
No circular dependencies
All components are properly exposed through their respective init.py files
Database components with proper schema management
FFmpeg components with process management
Queue system with state management
Processor components with proper handlers
Utility components with shared instances
Configuration components with validation
Initialization sequence is now properly ordered:
Config Manager initialization
Path setup
Database initialization
FFmpeg setup
Queue Manager initialization
Video Processor setup
Guild Components initialization
Update Checker startup
Queue Processing start
Proper cleanup handling is in place:
Component cleanup in reverse order
Resource cleanup with timeouts
Force cleanup for hung processes
System-wide FFmpeg process cleanup
Health monitoring is implemented for all components:
Database connection monitoring
Queue health checks
Processor status tracking
Component state validation
guild.py correctly imports cleanup_downloads directly from file_ops.py
initialization.py now correctly imports cleanup_downloads from file_ops.py
cleanup.py now correctly imports cleanup_downloads from file_ops.py
utils/init.py correctly re-exports both functions
The circular import has been resolved by:
Having all files import directly from file_ops.py
Removing the re-export of cleanup_downloads from cleanup.py
Ensuring proper async/await usage throughout
Component-based architecture with lifecycle management
Enhanced error handling and recovery mechanisms
Comprehensive state management and tracking
Event-driven architecture with monitoring
Queue Management:
Multiple processing strategies for different scenarios
Advanced state management with recovery
Comprehensive metrics and health monitoring
Sophisticated cleanup system with multiple strategies
Processing Pipeline:
Enhanced message handling with validation
Improved URL extraction and processing
Better queue management and monitoring
Advanced cleanup mechanisms
Overall Benefits:
Better code organization and maintainability
Improved error handling and recovery
Enhanced monitoring and reporting
More robust and reliable system
Improved the interaction response handling system to better manage both deferred and non-deferred responses
Enhanced error handling around interaction responses
Added proper fallback mechanisms for response handling
Fixed redbot import issues by importing specific exception classes
Ensured database setting is properly synchronized between base.py and config_manager.py
Added proper database initialization and reference handling
New database functionality and commands
Additional video format support (MKV)
Message duration now in hours (0-168)
Enhanced error handling and logging
Queue persistence and management improvements
Hardware acceleration updates
More detailed command descriptions
Improved performance & limitations documentation
Added missing asyncio import in events.py
Ensured all long-running operations are handled in background tasks
Fixed task initialization and management in base.py