Files
AEmotionStudio-ComfyUI-Disc…/bot/__main__.py
T

43 lines
1.0 KiB
Python

import asyncio
import logging
import sys
import os
from pathlib import Path
# Add project root to python path to allow imports
project_root = Path(__file__).resolve().parent.parent
sys.path.append(str(project_root))
from bot.config import BotConfig
from bot.bot import ComfyUIBot
from shared.logging_config import setup_logging
def main():
# Setup logging
setup_logging()
logger = logging.getLogger("bot")
# Load configuration
try:
config = BotConfig.load()
except Exception as e:
logger.critical(f"Failed to load configuration: {e}")
return
if not config.discord.token:
logger.critical("Discord token not found! Set DISCORDBOT_DISCORD_TOKEN env var or config.yaml")
return
# Initialize and run bot
bot = ComfyUIBot(config)
try:
bot.run(config.discord.token)
except KeyboardInterrupt:
logger.info("Bot stopped by user.")
except Exception as e:
logger.critical(f"Bot crashed: {e}")
if __name__ == "__main__":
main()