From f8c73659f20afed7bc8d7e863965c76e6180617d Mon Sep 17 00:00:00 2001 From: liuwei Date: Mon, 17 Feb 2025 15:39:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E9=AA=8C=E8=AF=81=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E9=80=BB=E8=BE=91=EF=BC=8C=E4=BB=A5=E4=B8=BA=E6=98=AF?= =?UTF-8?q?true=EF=BC=8C=E7=BB=93=E6=9E=9C=E6=98=AF=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E3=80=82=E5=AF=BC=E8=87=B4=E6=89=80=E6=9C=89=E7=BE=A4=E9=83=BD?= =?UTF-8?q?=E6=94=B6=E5=88=B0=E4=BA=86=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- robot.py | 5 +++++ robot_cmd/robot_command.py | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/robot.py b/robot.py index 9d50792..8e2f0f1 100644 --- a/robot.py +++ b/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: diff --git a/robot_cmd/robot_command.py b/robot_cmd/robot_command.py index 358d139..10caa11 100644 --- a/robot_cmd/robot_command.py +++ b/robot_cmd/robot_command.py @@ -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 "无效操作,仅支持启用或关闭"