Files
omnibot22/omnibot/__main__.py

28 lines
585 B
Python
Raw Normal View History

import asyncio
import logging
from .config import ServerConfig
from .bot import Bot
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s - %(name)-12s - %(levelname)-8s - %(message)s",
)
log = logging.getLogger(__name__)
log.debug("Loading config")
config = ServerConfig()
config.load("config.toml")
log.debug("Using configuration: %s", config)
bot = Bot(config)
try:
asyncio.run(bot.run())
except KeyboardInterrupt:
log.info("Got ctrl-c")
finally:
log.info("Quitting, press ctrl-c to quit immediately")
bot.quit()
asyncio.run(bot.keepalive())