diff --git a/plugins/simadmin/README.md b/plugins/simadmin/README.md index 02b747d..20bed45 100644 --- a/plugins/simadmin/README.md +++ b/plugins/simadmin/README.md @@ -26,16 +26,20 @@ plugin/scripts/simadmin_multi.py 插件头注已设置: ```text -# [admin: true] -# [rule: ^sim帮助$] -# [rule: ^sim配置$] -# [rule: ^sim管理$] -# [rule: ^sim状态(?:\s+\S+)?$] -# [rule: ^sim短信\s+\S+\s+\S+\s+[\s\S]+$] +#[admin: true] +#[rule: ^sim帮助$] +#[rule: ^sim配置$] +#[rule: ^sim管理$] +#[rule: ^sim状态(?:\s+\S+)?$] +#[rule: ^sim短信\s+\S+\s+\S+\s+[\s\S]+$] +#[priority: 900] +#[platform: qq,qb,wx,wb,tg,tb,fs,we,web,wxmp] ``` 即:仅管理员可用。代码内也会再次判断 `sender.isAdmin()`。 +> 实机排查修复:头注采用 Autman 官方常见的 `#[key: value]` 无空格格式,并扩展平台到 `qq,qb,wx,wb,tg,tb,fs,we,web,wxmp`。如果部署到外置微信/内置微信/频道等不同适配器,旧版只写 `qq,wx,tg,tb,fs` 可能导致规则未注册或平台不匹配,从而没有任何交互回应。 + ## 配置存储 插件配置存入 Autman 数据桶: diff --git a/plugins/simadmin/simadmin_multi.py b/plugins/simadmin/simadmin_multi.py index e6f5e2c..e96cc5d 100644 --- a/plugins/simadmin/simadmin_multi.py +++ b/plugins/simadmin/simadmin_multi.py @@ -1,19 +1,20 @@ -# [title: SimAdmin多实例管理] -# [language: python] -# [service: BOSS] -# [disable: false] -# [admin: true] -# [rule: ^sim帮助$] -# [rule: ^sim配置$] -# [rule: ^sim管理$] -# [rule: ^sim状态(?:\s+\S+)?$] -# [rule: ^sim短信\s+\S+\s+\S+\s+[\s\S]+$] -# [platform: qq,wx,tg,tb,fs] -# [open_source: true] -# [version: 1.2.0] -# [public: false] -# [price: 0] -# [description: 管理员专用:兼容多个 SimAdmin 实例,支持多级菜单配置管理、状态查询和短信发送。配置桶 otto/simadmin_instances。] +#[title: SimAdmin多实例管理] +#[language: python] +#[service: BOSS] +#[disable: false] +#[admin: true] +#[rule: ^sim帮助$] +#[rule: ^sim配置$] +#[rule: ^sim管理$] +#[rule: ^sim状态(?:\s+\S+)?$] +#[rule: ^sim短信\s+\S+\s+\S+\s+[\s\S]+$] +#[priority: 900] +#[platform: qq,qb,wx,wb,tg,tb,fs,we,web,wxmp] +#[open_source: true] +#[version: 1.2.1] +#[public: false] +#[price: 0] +#[description: 管理员专用:兼容多个 SimAdmin 实例,支持多级菜单配置管理、状态查询和短信发送。配置桶 otto/simadmin_instances。] """ Autman Python 插件:SimAdmin 多实例状态查询、短信发送、多级菜单配置管理。 @@ -62,12 +63,16 @@ def listen_text(sender, prompt, allow_empty=False, default=None): if value is None: raise SimAdminError("等待输入超时,已退出") value = str(value).strip().strip('"') - if value.lower() in ("q", "quit", "exit", "退出", "取消"): - raise SimAdminError("已取消") + # Autman listen 超时/无效输入在不少实机环境返回字符串 error,而不是 None。 + if value.lower() == "error": + raise SimAdminError("等待输入超时或监听失败,已退出") + # allow_empty=True 的场景允许直接回车/空消息走默认值。 if value == "" and default is not None: return default if value == "" and not allow_empty: raise SimAdminError("输入不能为空,已退出") + if value.lower() in ("q", "quit", "exit", "退出", "取消"): + raise SimAdminError("已取消") return value @@ -649,7 +654,10 @@ def main(): reply(sender, "SimAdmin插件提示:" + str(e)) except Exception as e: traceback.print_exc(file=sys.stderr) - reply(sender, "SimAdmin插件异常:" + str(e)) + try: + reply(sender, "SimAdmin插件异常:" + str(e)) + except Exception: + pass if __name__ == "__main__":