加入验证判断逻辑,以为是true,结果是文本。导致所有群都收到了消息

This commit is contained in:
liuwei
2025-02-17 15:39:38 +08:00
parent dc5be6c728
commit f8c73659f2
2 changed files with 7 additions and 2 deletions

View File

@@ -153,6 +153,11 @@ class Robot(Job):
return True
# 群管理自动加入,减少服务重启管理
else:
# 如果是群消息并且群没开启AI则不处理该动作
if msg.from_group() and self.gbm.get_group_permission(msg.roomid,
Feature.AI_CAPABILITY) == PermissionStatus.DISABLED:
self.sendTextMsg("群AI功能未开启", msg.roomid, msg.sender)
return True
rsp = self.chat.get_answer(q, (msg.roomid if msg.from_group() else msg.sender))
if rsp:

View File

@@ -150,14 +150,14 @@ class GroupBotManager:
GroupBotManager.local_cache["group_list"].add(group_id)
# 同步到 Redis
r.sadd("group:list", group_id)
return f"群机器人已启用,群组 {group_id} 已加入 group:list"
return f"ROT已启用,群组 {group_id} 已加入"
elif action == "关闭":
GroupBotManager.set_group_permission(group_id, feature, PermissionStatus.DISABLED)
# 关闭群机器人时,从 group:list 中删除 group_id
GroupBotManager.local_cache["group_list"].remove(group_id)
# 同步到 Redis
r.srem("group:list", group_id)
return f"群机器人已关闭,群组 {group_id}从 group:list 移除"
return f"ROT已关闭,群组 {group_id} 已移除"
else:
return "无效操作,仅支持启用或关闭"