mirror of
https://github.com/langbot-app/LangBot.git
synced 2025-11-25 19:37:36 +08:00
feat: 添加func命令
This commit is contained in:
29
pkg/qqbot/cmds/funcs/func.py
Normal file
29
pkg/qqbot/cmds/funcs/func.py
Normal file
@@ -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
|
||||||
|
|
||||||
Reference in New Issue
Block a user