Update: Major code refactor for modular extensibility
CI/CD Pipeline / Unit Tests (Python 3.11) (push) Successful in 29s
CI/CD Pipeline / Unit Tests (Python 3.12) (push) Successful in 30s
CI/CD Pipeline / Code Quality & Linting (push) Successful in 23s
CI/CD Pipeline / Unit Tests (Python 3.13) (push) Successful in 27s
CI/CD Pipeline / Integration Tests (push) Successful in 21s
CI/CD Pipeline / Security Scanning (push) Successful in 2m16s
CI/CD Pipeline / Generate Test Report (push) Successful in 4s
CI/CD Pipeline / Build Docker Image (push) Successful in 44s
CI/CD Pipeline / CI/CD Pipeline Status (push) Successful in 2s
CI/CD Pipeline / Unit Tests (Python 3.11) (push) Successful in 29s
CI/CD Pipeline / Unit Tests (Python 3.12) (push) Successful in 30s
CI/CD Pipeline / Code Quality & Linting (push) Successful in 23s
CI/CD Pipeline / Unit Tests (Python 3.13) (push) Successful in 27s
CI/CD Pipeline / Integration Tests (push) Successful in 21s
CI/CD Pipeline / Security Scanning (push) Successful in 2m16s
CI/CD Pipeline / Generate Test Report (push) Successful in 4s
CI/CD Pipeline / Build Docker Image (push) Successful in 44s
CI/CD Pipeline / CI/CD Pipeline Status (push) Successful in 2s
This commit is contained in:
1 parent
d891b21ffd
commit
346e6d9604
13 files changed
+3266
-443
No files matched your search
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Main entry point for the Pterodactyl Discord Bot.
|
||||
|
||||
This module replaces the original pterodisbot.py as the entry point.
|
||||
It loads configuration and starts the modular bot application.
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
import sys
|
||||
|
||||
from bot import run_bot
|
||||
from config import load_config, ConfigValidationError
|
||||
from exceptions import PterodisBotError
|
||||
from logging_config import setup_logging
|
||||
|
||||
# Configure application logging
|
||||
setup_logging()
|
||||
|
||||
logger = logging.getLogger("pterodisbot")
|
||||
|
||||
|
||||
def main() -> int:
|
||||
"""
|
||||
Synchronous entry point for the bot application.
|
||||
|
||||
Returns:
|
||||
Exit code (0 for success, 1 for error)
|
||||
"""
|
||||
try:
|
||||
# Load and validate configuration
|
||||
logger.info("Loading configuration...")
|
||||
config = load_config("config.ini")
|
||||
logger.info(f"Configuration loaded - Panel type: {config.get_panel_display_name()}")
|
||||
|
||||
# Run the bot
|
||||
asyncio.run(run_bot(config))
|
||||
return 0
|
||||
|
||||
except ConfigValidationError as e:
|
||||
logger.critical(f"Configuration error: {str(e)}")
|
||||
return 1
|
||||
except PterodisBotError as e:
|
||||
logger.critical(f"Application error: {str(e)}")
|
||||
return 1
|
||||
except KeyboardInterrupt:
|
||||
pass # Already logged by signal handler
|
||||
except Exception as e:
|
||||
logger.critical(f"Unexpected error during startup: {str(e)}", exc_info=True)
|
||||
return 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in new issue
Block a user