fix(telegram): answerCallbackQuery result=true 導致 bool is not iterable
All checks were successful
CD Pipeline / build-and-deploy (push) Successful in 13m3s
All checks were successful
CD Pipeline / build-and-deploy (push) Successful in 13m3s
Telegram answerCallbackQuery 成功時返回 {"ok": true, "result": true},
_send_request 中 "message_id" in result["result"] 對 bool 做 in 操作
報 "argument of type 'bool' is not iterable"。
修正:加 isinstance(result_val, dict) 防禦後再做 in 檢查。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1168,9 +1168,10 @@ class TelegramGateway:
|
||||
f"Telegram API error: {result.get('description', 'Unknown error')}"
|
||||
)
|
||||
|
||||
# 成功: 記錄 message_id
|
||||
if "result" in result and "message_id" in result["result"]:
|
||||
span.set_attribute("telegram.message_id", result["result"]["message_id"])
|
||||
# 成功: 記錄 message_id (result 可能是 dict 或 bool,需防禦)
|
||||
result_val = result.get("result")
|
||||
if isinstance(result_val, dict) and "message_id" in result_val:
|
||||
span.set_attribute("telegram.message_id", result_val["message_id"])
|
||||
|
||||
span.set_status(trace.Status(trace.StatusCode.OK))
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user