From f1bb3045aa0ba4a7a39bc4ca8b64e7280228253f Mon Sep 17 00:00:00 2001 From: RockChinQ <1010553892@qq.com> Date: Sat, 29 Jul 2023 17:26:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0func=E5=91=BD?= =?UTF-8?q?=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/qqbot/cmds/funcs/func.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 pkg/qqbot/cmds/funcs/func.py diff --git a/pkg/qqbot/cmds/funcs/func.py b/pkg/qqbot/cmds/funcs/func.py new file mode 100644 index 00000000..414f406a --- /dev/null +++ b/pkg/qqbot/cmds/funcs/func.py @@ -0,0 +1,29 @@ +from ..aamgr import AbstractCommandNode, Context +import logging + + +@AbstractCommandNode.register( + parent=None, + name="func", + description="管理内容函数", + usage="!func", + aliases=[], + privilege=1 +) +class FuncCommand(AbstractCommandNode): + @classmethod + def process(cls, ctx: Context) -> tuple[bool, list]: + from pkg.plugin.models import host + + reply = [] + + reply_str = "当前已加载的内容函数:\n\n" + + index = 1 + for func in host.__callable_functions__: + reply_str += "{}. {}{}:\n{}\n\n".format(index, ("(已禁用) " if not func['enabled'] else ""), func['name'], func['description']) + + reply = [reply_str] + + return True, reply + \ No newline at end of file