From b719da7400fc5ec4d4499ffaee4b3c87f6d4848d Mon Sep 17 00:00:00 2001 From: Xubin Ren Date: Mon, 6 Apr 2026 11:39:23 +0000 Subject: [PATCH] fix(feishu): use RawRequest for bot info API --- nanobot/channels/feishu.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/nanobot/channels/feishu.py b/nanobot/channels/feishu.py index 7d75705a2..4798b818b 100644 --- a/nanobot/channels/feishu.py +++ b/nanobot/channels/feishu.py @@ -408,12 +408,18 @@ class FeishuChannel(BaseChannel): def _fetch_bot_open_id(self) -> str | None: """Fetch the bot's own open_id via GET /open-apis/bot/v3/info.""" - from lark_oapi.api.bot.v3 import GetBotInfoRequest try: - request = GetBotInfoRequest.builder().build() - response = self._client.bot.v3.bot_info.get(request) - if response.success() and response.data and response.data.bot: - return getattr(response.data.bot, "open_id", None) + import lark_oapi as lark + request = lark.RawRequest.builder() \ + .http_method(lark.HttpMethod.GET) \ + .uri("/open-apis/bot/v3/info") \ + .build() + response = self._client.request(request) + if response.success(): + import json + data = json.loads(response.raw.content) + bot = (data.get("data") or data).get("bot") or data.get("bot") or {} + return bot.get("open_id") logger.warning("Failed to get bot info: code={}, msg={}", response.code, response.msg) return None except Exception as e: