Added support for libbot 4.1.0

This commit is contained in:
2025-04-16 15:54:52 +02:00
parent e906852abe
commit b85ca1d017
6 changed files with 14 additions and 10 deletions

10
main.py
View File

@@ -3,8 +3,9 @@ import logging
from argparse import ArgumentParser
from os import getpid
from pathlib import Path
from sys import exit
from libbot import sync
from libbot.utils import config_get, json_read
from classes.pyroclient import PyroClient
@@ -22,7 +23,7 @@ from modules.scheduler import scheduler
logging.basicConfig(
level=logging.DEBUG if sync.config_get("debug") else logging.INFO,
level=logging.DEBUG if config_get("debug") else logging.INFO,
format="%(name)s.%(funcName)s | %(levelname)s | %(message)s",
datefmt="[%X]",
)
@@ -53,7 +54,7 @@ def main():
exit()
client = PyroClient(
scheduler=scheduler, commands_source=sync.json_read(Path("commands.json"))
scheduler=scheduler, commands_source=json_read(Path("commands.json"))
)
# Conversation(client)
@@ -61,6 +62,9 @@ def main():
client.run()
except KeyboardInterrupt:
logger.warning("Forcefully shutting down with PID %s...", getpid())
except Exception as exc:
logger.error("An unexpected exception has occurred: %s", exc, exc_info=exc)
exit(1)
finally:
if client.scheduler is not None:
client.scheduler.shutdown()