优化天气插件

This commit is contained in:
liuwei
2025-05-22 11:42:15 +08:00
parent 5b99a4fbc6
commit e04c0f0b74

View File

@@ -172,11 +172,10 @@ class WeatherPlugin(MessagePluginInterface):
params=params) as response:
geoapi_json = await response.json()
await conn_ssl.close()
self.LOG.debug(f"geoapi_json: {geoapi_json}")
if 'code' not in geoapi_json:
self.LOG.error(f"API响应格式错误缺少code字段")
self.LOG.debug(f"未查询到城市信息:{city_name},{geoapi_json}")
return ""
if geoapi_json['code'] == '404':
return ""
elif geoapi_json['code'] != '200':