kexue-z / nonebot-plugin-heweather

MIT License
63 stars 11 forks source link

成功查询一次后故障 #29

Closed Astolfocat closed 2 years ago

Astolfocat commented 2 years ago

安装插件并在env.dev中设置【QWEATHER_APIKEY】和【QWEATHER_APITYPE】 然后发送命令,成功返回查询到的天气图片。更换城市后再次查询,查询失败,一直找不到城市(CityNotFoundError)。并且之前成功查询的天气也查询失败。

日志如下: 07-15 11:49:04 [INFO] nonebot_plugin_gocqhttp | [3154035878] 收到群 XX 内 XX 的消息: /成都天气 (-726652545) 07-15 11:49:04 [SUCCESS] nonebot | ONEBOT V11 3154035878 | [message.group.normal]: Message -726652545 from XX@[群:XX] "/成都天气" 07-15 11:49:04 [INFO] nonebot | Event will be handled by <Matcher from src.plugins.nonebot_plugin_heweather, type=message, priority=1, temp=False> 07-15 11:49:04 [INFO] src | 使用普通版API 07-15 11:49:05 [INFO] nonebot_plugin_gocqhttp | [3154035878] 发送群 XX 的消息: [{"type": ... (-1548281367) 07-15 11:49:05 [INFO] nonebot | Matcher <Matcher from src.plugins.nonebot_plugin_heweather, type=message, priority=1, temp=False> running complete

切换【QWEATHER_APITYPE】为 1(个人开发版)也不行。

不管查询什么城市的天气均会进入如下代码的【except CityNotFoundError】部分 代码如下: @weather.handle() async def (matcher: Matcher, args: Tuple[str, ...] = RegexGroup()): city = args[0].strip() or args[1].strip() if not city: await weather.finish("地点是...空气吗?? ><")

w_data = Weather(city_name=city, api_key=api_key, api_type=api_type)
try:
    await w_data.load_data()
except CityNotFoundError:
    matcher.block = False
    await weather.finish("未找到城市")
kexue-z commented 2 years ago

不需要/ 呢亲

Astolfocat commented 2 years ago

不需要/ 呢亲

首次使用的时候,不使用/无法识别为命令,使用/后才成功

kexue-z commented 2 years ago

? 那必不可能