From 7e83ba3f77f4c8b34e2ff356bd1dd7e8ce14ebc8 Mon Sep 17 00:00:00 2001 From: Rock Chin <1010553892@qq.com> Date: Sun, 1 Jan 2023 22:55:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E6=8C=87=E4=BB=A4?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E7=83=AD=E6=9B=B4=E6=96=B0=E5=92=8C=E7=83=AD?= =?UTF-8?q?=E9=87=8D=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/qqbot/process.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pkg/qqbot/process.py b/pkg/qqbot/process.py index 16a4ced9..afbdba6c 100644 --- a/pkg/qqbot/process.py +++ b/pkg/qqbot/process.py @@ -14,6 +14,8 @@ import config import pkg.openai.session import pkg.openai.manager +import pkg.utils.reloader +import pkg.utils.updater processing = [] @@ -157,6 +159,21 @@ def process_message(launcher_type: str, launcher_id: int, text_message: str, mes if not (hasattr(config, 'include_image_description') and not config.include_image_description): reply.append(" ".join(params)) + elif cmd == 'reload' and launcher_type == 'person' and launcher_id == config.admin_qq: + try: + pkg.utils.reloader.reload_all() + reply = ["[bot]已重新加载所有模块"] + except Exception as e: + logging.error("reload failed:{}".format(e)) + reply = ["[bot]重载失败:{}".format(e)] + elif cmd == 'update' and launcher_type == 'person' and launcher_id == config.admin_qq: + try: + pkg.utils.updater.update_all() + pkg.utils.reloader.reload_all() + reply = ["[bot]已更新所有模块"] + except Exception as e: + logging.error("update failed:{}".format(e)) + reply = ["[bot]更新失败:{}".format(e)] except Exception as e: mgr.notify_admin("{}指令执行失败:{}".format(session_name, e)) logging.exception(e)