diff --git a/plugins/banwords/banwords.py b/plugins/banwords/banwords.py index 9488b5ad3..27414a294 100644 --- a/plugins/banwords/banwords.py +++ b/plugins/banwords/banwords.py @@ -60,4 +60,7 @@ def on_handle_context(self, e_context: EventContext): reply = Reply(ReplyType.INFO, "发言中包含敏感词,请重试: \n"+self.searchr.Replace(content)) e_context['reply'] = reply e_context.action = EventAction.BREAK_PASS - return \ No newline at end of file + return + + def get_help_text(self, **kwargs): + return Banwords.desc \ No newline at end of file diff --git a/plugins/dungeon/dungeon.py b/plugins/dungeon/dungeon.py index 36f9386c9..e156ae7f5 100644 --- a/plugins/dungeon/dungeon.py +++ b/plugins/dungeon/dungeon.py @@ -80,4 +80,7 @@ def on_handle_context(self, e_context: EventContext): prompt = self.games[sessionid].action(content) e_context['context'].type = ContextType.TEXT e_context['context'].content = prompt - e_context.action = EventAction.CONTINUE \ No newline at end of file + e_context.action = EventAction.BREAK # 事件结束,不跳过处理context的默认逻辑 + def get_help_text(self, **kwargs): + help_text = "输入\"$开始冒险 {背景故事}\"来以{背景故事}开始一个地牢游戏,之后你的所有消息会帮助我来完善这个故事。输入\"$停止冒险 \"可以结束游戏。" + return help_text \ No newline at end of file diff --git a/plugins/godcmd/godcmd.py b/plugins/godcmd/godcmd.py index 3a8f770df..e36af2b41 100644 --- a/plugins/godcmd/godcmd.py +++ b/plugins/godcmd/godcmd.py @@ -19,6 +19,11 @@ "alias": ["help", "帮助"], "desc": "打印指令集合", }, + "helpp": { + "alias": ["helpp", "插件帮助"], + "args": ["插件名"], + "desc": "打印插件的帮助信息", + }, "auth": { "alias": ["auth", "认证"], "args": ["口令"], @@ -161,6 +166,16 @@ def on_handle_context(self, e_context: EventContext): ok, result = self.authenticate(user, args, isadmin, isgroup) elif cmd == "help": ok, result = True, get_help_text(isadmin, isgroup) + elif cmd == "helpp": + if len(args) != 1: + ok, result = False, "请提供插件名" + else: + plugins = PluginManager().list_plugins() + name = args[0].upper() + if name in plugins and plugins[name].enabled: + ok, result = True, PluginManager().instances[name].get_help_text(isgroup=isgroup, isadmin=isadmin) + else: + ok, result= False, "插件不存在或未启用" elif cmd == "id": ok, result = True, f"用户id=\n{user}" elif cmd == "reset": @@ -288,3 +303,5 @@ def authenticate(self, userid, args, isadmin, isgroup) -> Tuple[bool,str] : else: return False,"认证失败" + def get_help_text(self, isadmin = False, isgroup = False, **kwargs): + return get_help_text(isadmin, isgroup) \ No newline at end of file diff --git a/plugins/hello/hello.py b/plugins/hello/hello.py index c01b743b3..be4cc0531 100644 --- a/plugins/hello/hello.py +++ b/plugins/hello/hello.py @@ -44,3 +44,7 @@ def on_handle_context(self, e_context: EventContext): e_context['context'].type = ContextType.IMAGE_CREATE content = "The World" e_context.action = EventAction.CONTINUE # 事件继续,交付给下个插件或默认逻辑 + + def get_help_text(self, **kwargs): + help_text = "输入Hello,我会回复你的名字\n输入End,我会回复你世界的图片\n" + return help_text diff --git a/plugins/plugin.py b/plugins/plugin.py index 865eecbe9..289b4f84d 100644 --- a/plugins/plugin.py +++ b/plugins/plugin.py @@ -1,3 +1,6 @@ class Plugin: def __init__(self): self.handlers = {} + + def get_help_text(self, **kwargs): + return "暂无帮助信息" \ No newline at end of file diff --git a/plugins/role/role.py b/plugins/role/role.py index e5ba5f30f..ad6f11abd 100644 --- a/plugins/role/role.py +++ b/plugins/role/role.py @@ -117,10 +117,10 @@ def on_handle_context(self, e_context: EventContext): prompt = self.roleplays[sessionid].action(content) e_context['context'].type = ContextType.TEXT e_context['context'].content = prompt - e_context.action = EventAction.CONTINUE + e_context.action = EventAction.BREAK - def get_help_text(self): - help_text = "输入\"$角色 (角色名)\"或\"$role (角色名)\"为我设定角色吧,\"$停止扮演 \" 可以清除设定的角色。\n\n目前可用角色列表:\n" + def get_help_text(self, **kwargs): + help_text = "输入\"$角色 {角色名}\"或\"$role {角色名}\"为我设定角色吧,\"$停止扮演 \" 可以清除设定的角色。\n\n目前可用角色列表:\n" for role in self.roles: help_text += f"[{role}]: {self.roles[role]['remark']}\n" return help_text diff --git a/plugins/sdwebui/sdwebui.py b/plugins/sdwebui/sdwebui.py index 56842e88c..04a3bd419 100644 --- a/plugins/sdwebui/sdwebui.py +++ b/plugins/sdwebui/sdwebui.py @@ -97,7 +97,7 @@ def on_handle_context(self, e_context: EventContext): finally: e_context['reply'] = reply - def get_help_text(self): + def get_help_text(self, **kwargs): if not conf().get('image_create_prefix'): return "画图功能未启用" else: