zhaomaoniu / nonebot-plugin-steam-info

✨ Steam 好友状态播报 NoneBot 插件 ✨
MIT License
40 stars 6 forks source link

定时播报任务无法执行 #18

Closed Alpaca4610 closed 1 month ago

Alpaca4610 commented 2 months ago

报错如下: Traceback (most recent call last): File "/root/LittlePaimon/bot.py", line 37, in nonebot.run(app="mp_main__:app", access_log=False) File "/root/.cache/pypoetry/virtualenvs/littlepaimon-VcV7FQZJ-py3.10/lib/python3.10/site-packages/nonebot/init__.py", line 335, in run get_driver().run(*args, **kwargs) File "/root/.cache/pypoetry/virtualenvs/littlepaimon-VcV7FQZJ-py3.10/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 186, in run uvicorn.run( File "/root/.cache/pypoetry/virtualenvs/littlepaimon-VcV7FQZJ-py3.10/lib/python3.10/site-packages/uvicorn/main.py", line 587, in run server.run() File "/root/.cache/pypoetry/virtualenvs/littlepaimon-VcV7FQZJ-py3.10/lib/python3.10/site-packages/uvicorn/server.py", line 62, in run return asyncio.run(self.serve(sockets=sockets)) File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run return loop.run_until_complete(main)

File "/root/.cache/pypoetry/virtualenvs/littlepaimon-VcV7FQZJ-py3.10/lib/python3.10/site-packages/apscheduler/executors/base_py3.py", line 30, in run_coroutine_job retval = await job.func(*job.args, job.kwargs) File "/root/.cache/pypoetry/virtualenvs/littlepaimon-VcV7FQZJ-py3.10/lib/python3.10/site-packages/nonebot_plugin_steam_info/init.py", line 234, in fetch_and_broadcast_steam_info await broadcast_steam_info(parent_id, old_players, new_players) File "/root/.cache/pypoetry/virtualenvs/littlepaimon-VcV7FQZJ-py3.10/lib/python3.10/site-packages/nonebot_plugin_steam_info/init.py", line 200, in broadcast_steam_info await uni_msg.send( File "/root/.cache/pypoetry/virtualenvs/littlepaimon-VcV7FQZJ-py3.10/lib/python3.10/site-packages/nonebot_plugin_alconna/uniseg/message.py", line 1393, in send res = await fn.send_to(target, bot, msg, kwargs) File "/root/.cache/pypoetry/virtualenvs/littlepaimon-VcV7FQZJ-py3.10/lib/python3.10/site-packages/nonebot_plugin_alconna/uniseg/adapters/onebot11/exporter.py", line 163, in send_to return await bot.send_msg(message_type="group", group_id=int(_target.id), message=message, **kwargs) ValueError: invalid literal for int() with base 10: ''

zhaomaoniu commented 2 months ago

使用的是 OneBot V11 适配器吗?对接的协议端是哪个?

Alpaca4610 commented 2 months ago

使用的是 OneBot V11 适配器吗?对接的协议端是哪个?

是OneBot V11,对接的是gocq,目前是有的账号可以正常播报,有的会报错

zhaomaoniu commented 2 months ago

能不能观察一下NoneBot出现这个报错的时候,NoneBot和gocq的日志是什么?我需要确认这是协议端的问题还是NoneBot这边处理的问题。

NoneBot的日志请包含OneBot V11适配器输出的事件日志,e.g. [message.group] Message xxx from xxx@[群:xxx]

Alpaca4610 commented 2 months ago

好的,这个bug触发的条件有点奇怪,目前只会在某几个特定的群友启动游戏时触发不能播报的情况,我先观察一下

Alpaca4610 commented 2 months ago

Nonebot端报错: `08-30 17:05:44 [ERROR] apscheduler | Job "fetch_and_broadcast_steam_info (trigger: interval[0:05:00], next run at: 2024-08-30 17:10:43 CST)" raised an exception Traceback (most recent call last): File "/root/LittlePaimon/bot.py", line 37, in nonebot.run(app="mp_main__:app", access_log=False) File "/root/.cache/pypoetry/virtualenvs/littlepaimon-VcV7FQZJ-py3.10/lib/python3.10/site-packages/nonebot/init__.py", line 335, in run get_driver().run(*args, **kwargs) File "/root/.cache/pypoetry/virtualenvs/littlepaimon-VcV7FQZJ-py3.10/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 186, in run uvicorn.run( File "/root/.cache/pypoetry/virtualenvs/littlepaimon-VcV7FQZJ-py3.10/lib/python3.10/site-packages/uvicorn/main.py", line 587, in run server.run() File "/root/.cache/pypoetry/virtualenvs/littlepaimon-VcV7FQZJ-py3.10/lib/python3.10/site-packages/uvicorn/server.py", line 62, in run return asyncio.run(self.serve(sockets=sockets)) File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run return loop.run_until_complete(main)

File "/root/.cache/pypoetry/virtualenvs/littlepaimon-VcV7FQZJ-py3.10/lib/python3.10/site-packages/apscheduler/executors/base_py3.py", line 30, in run_coroutine_job retval = await job.func(*job.args, job.kwargs) File "/root/.cache/pypoetry/virtualenvs/littlepaimon-VcV7FQZJ-py3.10/lib/python3.10/site-packages/nonebot_plugin_steam_info/init.py", line 234, in fetch_and_broadcast_steam_info await broadcast_steam_info(parent_id, old_players, new_players) File "/root/.cache/pypoetry/virtualenvs/littlepaimon-VcV7FQZJ-py3.10/lib/python3.10/site-packages/nonebot_plugin_steam_info/init.py", line 200, in broadcast_steam_info await uni_msg.send( File "/root/.cache/pypoetry/virtualenvs/littlepaimon-VcV7FQZJ-py3.10/lib/python3.10/site-packages/nonebot_plugin_alconna/uniseg/message.py", line 1393, in send res = await fn.send_to(target, bot, msg, kwargs) File "/root/.cache/pypoetry/virtualenvs/littlepaimon-VcV7FQZJ-py3.10/lib/python3.10/site-packages/nonebot_plugin_alconna/uniseg/adapters/onebot11/exporter.py", line 163, in send_to return await bot.send_msg(message_type="group", group_id=int(_target.id), message=message, **kwargs) ValueError: invalid literal for int() with base 10: ''`

gocq端无报错

zhaomaoniu commented 2 months ago

看起来你使用的是linux,能否进入~/.local/share/nonebot_plugin_steaminfo中的bind_data.json中,找到键为空字符串的元素并将其整个删除?之后尝试运行一段时间后观察是否还有类型行为出现。

很抱歉提出这样奇怪的方案。我猜测这是由于gocq在某次上报时缺少group_id字段导致的。虽然这在我的认知里不太可能发生,但毕竟我已经将近一年没有使用过gocq了,所以可能性存在。。

zhaomaoniu commented 1 month ago

请问问题还有没有出现呢?

Alpaca4610 commented 1 month ago

请问问题还有没有出现呢?

不好意思,最近有点忙没来得及测试。刚刚按照你的给的方法删除了空的键之后,播报正常啦。感谢回答。