From 7dddaedb9a07f5372d5a742da59a479a804948c5 Mon Sep 17 00:00:00 2001 From: liuwei Date: Mon, 24 Feb 2025 12:20:51 +0800 Subject: [PATCH] =?UTF-8?q?#=20=E5=85=BC=E5=AE=B9=E4=B8=8D@=20=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5/=E8=A7=A6=E5=8F=91=E6=8C=87=E4=BB=A4=EF=BC=8C?= =?UTF-8?q?=E5=9B=9E=E7=AD=94=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- robot.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/robot.py b/robot.py index 46963e1..f49aa7a 100644 --- a/robot.py +++ b/robot.py @@ -234,6 +234,17 @@ class Robot(Job): except Exception as e: self.LOG.error(f"revoke_receive_message error: {e}") + # 兼容不@ 直接/触发指令,回答问题。 + try: + if msg.content.startswith("/"): + # 因为内容中存在空格指令,所以不能使用 + self.LOG.info(f"msg.content:{msg.content}\n game_message: {msg.content}") + resp = game_process_message(group_id=msg.roomid, player_id=msg.sender, message=msg.content, + player_name=self.allContacts.get(msg.sender, msg.sender)) + self.sendTextMsg(resp, msg.roomid, msg.sender) + return + except Exception as e: + self.LOG.error(f"game_message_load error:{e}") try: # TODO 群人员添加也是消息类型10000的消息 result = self.gmc.process_message(msg.roomid, msg.xml)