加入验证判断逻辑,以为是true,结果是文本。导致所有群都收到了消息
This commit is contained in:
5
robot.py
5
robot.py
@@ -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:
|
||||
|
||||
@@ -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 "无效操作,仅支持启用或关闭"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user