CI/CD Pipeline / Unit Tests (Python 3.12) (push) Successful in 30s
CI/CD Pipeline / Unit Tests (Python 3.13) (push) Successful in 35s
CI/CD Pipeline / Code Quality & Linting (push) Successful in 27s
CI/CD Pipeline / Security Scanning (push) Successful in 2m23s
CI/CD Pipeline / Unit Tests (Python 3.11) (push) Successful in 24s
CI/CD Pipeline / Integration Tests (push) Successful in 26s
CI/CD Pipeline / Generate Test Report (push) Successful in 9s
CI/CD Pipeline / Build Docker Image (push) Successful in 41s
CI/CD Pipeline / CI/CD Pipeline Status (push) Successful in 2s
55 lines
1.4 KiB
Python
55 lines
1.4 KiB
Python
#!/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()) |