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