From e575440acfd8b5f1e8c30e83dfcb972d26175729 Mon Sep 17 00:00:00 2001
From: AmandaloveYang <2569718930@qq.com>
Date: Sun, 22 Feb 2026 10:30:26 +0800
Subject: [PATCH] feat: migrate to `ApplicationBuilder` for bot setup, load
configuration from `BotConfig`, and add timeouts for API calls.
---
bot_listener.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/bot_listener.py b/bot_listener.py
index f20a179c..79dd633c 100644
--- a/bot_listener.py
+++ b/bot_listener.py
@@ -47,6 +47,11 @@ def analyze_weather_trend(weather_data, temp_symbol):
forecast_high = max(forecast_highs) if forecast_highs else None
# 取最低值用于判断是否“已触及预报高位”
min_forecast_high = min(forecast_highs) if forecast_highs else forecast_high
+ # 取中位数作为用户可见的"预期值"(避免极端模型误导)
+ forecast_median = None
+ if forecast_highs:
+ sorted_fh = sorted(forecast_highs)
+ forecast_median = sorted_fh[len(sorted_fh) // 2]
wind_speed = metar.get("current", {}).get("wind_speed_kt", 0)
@@ -225,7 +230,8 @@ def analyze_weather_trend(weather_data, temp_symbol):
if last_peak_h < 6:
insights.append(f"⚠️ 提示:预测最热在凌晨,后续气温可能一路走低。")
elif local_hour < first_peak_h and (max_so_far is None or max_so_far < forecast_high):
- insights.append(f"🎯 关注重点:看看那个时段温度能不能真的到 {forecast_high}{temp_symbol}。")
+ target_temp = forecast_median if forecast_median is not None else forecast_high
+ insights.append(f"🎯 关注重点:看看那个时段温度能不能真的到 {target_temp}{temp_symbol}。")
else:
# 兜底默认值
first_peak_h, last_peak_h = 13, 15