#!/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())