diff --git a/robot.py b/robot.py index d97c48a..a242246 100644 --- a/robot.py +++ b/robot.py @@ -205,6 +205,14 @@ class Robot(Job): self.refresh_contacts() except Exception as e: self.LOG.error(f"加入新群,自动添加并开启机器人功能 error: {e}") + + # 发布消息接收事件 + self.event_system.publish(EventType.MESSAGE_RECEIVED, {"message": msg}) + + # 尝试使用插件处理消息 + if self.process_plugin_message(msg): + return + # 如果没有插件处理,使用原有逻辑处理消息 # 群聊消息 if msg.from_group(): @@ -236,15 +244,7 @@ class Robot(Job): if msg.is_at(self.wxid): # 被@ self.toAt(msg) - return # 处理完群聊信息,后面就不需要处理了 - - - # 发布消息接收事件 - self.event_system.publish(EventType.MESSAGE_RECEIVED, {"message": msg}) - - # 尝试使用插件处理消息 - if self.process_plugin_message(msg): - return + return # 处理完群聊信息,后面就不需要处理了 # 非群聊信息,按消息类型进行处理 if msg.type == 37: # 好友请求