From 4ff3757936c5aa82a0b721fc33e54504b57eb6f3 Mon Sep 17 00:00:00 2001 From: DuTao Date: Fri, 3 Apr 2026 18:00:04 +0800 Subject: [PATCH] channel mention --- bot/vikingbot/agent/loop.py | 2 +- bot/vikingbot/channels/base.py | 2 ++ bot/vikingbot/channels/feishu.py | 5 ++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bot/vikingbot/agent/loop.py b/bot/vikingbot/agent/loop.py index 2bfef8e51..5ad93f369 100644 --- a/bot/vikingbot/agent/loop.py +++ b/bot/vikingbot/agent/loop.py @@ -484,7 +484,7 @@ async def check_long_running(): await self.sessions.save(session) return OutboundMessage( session_key=msg.session_key, - content=None, + content="", metadata=msg.metadata, event_type=OutboundEventType.NO_REPLY, ) diff --git a/bot/vikingbot/channels/base.py b/bot/vikingbot/channels/base.py index 1cf2b3d00..924d3ca2d 100644 --- a/bot/vikingbot/channels/base.py +++ b/bot/vikingbot/channels/base.py @@ -145,6 +145,7 @@ async def _handle_message( sender_id: str, chat_id: str, content: str, + need_reply: bool = True, media: list[str] | None = None, metadata: dict[str, Any] | None = None, ) -> None: @@ -174,6 +175,7 @@ async def _handle_message( chat_id=chat_id, ), sender_id=str(sender_id), + need_reply=need_reply, content=content, media=media or [], metadata=metadata or {}, diff --git a/bot/vikingbot/channels/feishu.py b/bot/vikingbot/channels/feishu.py index bfe75501d..451b23b9f 100644 --- a/bot/vikingbot/channels/feishu.py +++ b/bot/vikingbot/channels/feishu.py @@ -809,12 +809,10 @@ async def _on_message(self, data: "P2ImMessageReceiveV1") -> None: # 6. 检查是否需要处理该消息 should_process = await self._check_should_process(chat_type, chat_id, message, is_mentioned) - if not should_process: - return # 7. 添加已读表情 config = load_config() - if config.mode != BotMode.DEBUG: + if config.mode != BotMode.DEBUG and should_process: await self._add_reaction(message_id, "MeMeMe") # 8. 处理@占位符 @@ -840,6 +838,7 @@ async def _on_message(self, data: "P2ImMessageReceiveV1") -> None: chat_id=final_chat_id, content=content, media=media if media else None, + need_reply=should_process, metadata={ "message_id": message_id, "chat_type": chat_type,