调整天气指令

This commit is contained in:
liuwei
2025-05-15 14:06:04 +08:00
parent a1d7cd1b53
commit c0ae28143d

View File

@@ -148,13 +148,13 @@ class WeatherPlugin(MessagePluginInterface):
elif content.endswith("天气"):
# 格式: "北京天气"
return content[:-2]
else:
# 尝试分离"天气"和城市名
parts = content.split("天气")
if len(parts) == 2:
# 选择非空的部分作为城市名
return parts[0] if parts[0] else parts[1]
# else:
# # 尝试分离"天气"和城市名
# parts = content.split("天气")
# if len(parts) == 2:
# # 选择非空的部分作为城市名
# return parts[0] if parts[0] else parts[1]
#
return ""
async def _get_weather_info(self, city_name: str) -> str: