CI/CD Pipeline / Unit Tests (Python 3.12) (push) Successful in 33s
CI/CD Pipeline / Unit Tests (Python 3.13) (push) Successful in 32s
CI/CD Pipeline / Code Quality & Linting (push) Successful in 26s
CI/CD Pipeline / Security Scanning (push) Successful in 24s
CI/CD Pipeline / Unit Tests (Python 3.11) (push) Successful in 30s
CI/CD Pipeline / Integration Tests (push) Successful in 18s
CI/CD Pipeline / Generate Test Report (push) Successful in 11s
CI/CD Pipeline / Build Docker Image (push) Successful in 55s
CI/CD Pipeline / CI/CD Pipeline Status (push) Successful in 2s
CI/CD Pipeline / Unit Tests (Python 3.11) (pull_request) Successful in 46s
CI/CD Pipeline / Unit Tests (Python 3.12) (pull_request) Successful in 47s
CI/CD Pipeline / Unit Tests (Python 3.13) (pull_request) Successful in 48s
CI/CD Pipeline / Code Quality & Linting (pull_request) Successful in 29s
CI/CD Pipeline / Security Scanning (pull_request) Successful in 33s
CI/CD Pipeline / Build Docker Image (pull_request) Skipped
CI/CD Pipeline / CI/CD Pipeline Status (pull_request) Successful in 2s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 19s
CI/CD Pipeline / Generate Test Report (pull_request) Successful in 3s
54 lines
1.3 KiB
Python
54 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Main entry point for the bot.
|
|
|
|
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()) |