2022-05-23 18:47:28 -07:00
|
|
|
import asyncio
|
2022-05-24 19:16:15 -07:00
|
|
|
from functools import partial
|
2022-05-23 18:47:28 -07:00
|
|
|
import logging
|
2022-05-24 19:16:15 -07:00
|
|
|
import signal
|
2022-05-23 18:47:28 -07:00
|
|
|
|
|
|
|
|
from .config import ServerConfig
|
|
|
|
|
from .bot import Bot
|
|
|
|
|
|
|
|
|
|
logging.basicConfig(
|
|
|
|
|
level=logging.DEBUG,
|
|
|
|
|
format="%(asctime)s - %(name)-12s - %(levelname)-8s - %(message)s",
|
|
|
|
|
)
|
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
|
2022-05-24 19:16:15 -07:00
|
|
|
log.debug("Loading config")
|
|
|
|
|
config = ServerConfig()
|
|
|
|
|
config.load("config.toml")
|
|
|
|
|
log.debug("Using configuration: %s", config)
|
2022-05-23 18:47:28 -07:00
|
|
|
|
2022-05-24 19:16:15 -07:00
|
|
|
bot = Bot(config)
|
2022-05-23 18:47:28 -07:00
|
|
|
|
2022-05-24 19:16:15 -07:00
|
|
|
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())
|