Well2333 / nonebot-plugin-bilichat

一个通过 OpenAI 来对b站视频进行总结的多功能 B站解析插件
GNU Affero General Public License v3.0
206 stars 8 forks source link

Bug: mirai2无回复 #177

Closed Plandres closed 6 months ago

Plandres commented 6 months ago

操作系统

Linux

Python 版本

3.10.12

NoneBot 版本

nonebot cli version 1.2.8

Bilichat 版本

5.1.3

描述问题

nonebot无法回复消息,如输入“/查看”,后台能看到nonebot接受到了消息,但qq无回应,使用的适配器是mirai2,看上去是“Handler Dependent(call=check_sub) skipped”的问题

01-08 22:36:25 [SUCCESS] nonebot | mirai2 1361804427 | [GroupMessage]: {'self_id': , 'type': 'GroupMessage', 'message_chain': [{'type': 'Plain', 'data': {'text': '/查看'}}], 'source': {'id': 4259, 'time': '2024-01-08T14:36:25+00:00'}, 'sender': {'id': , 'name': '七九殇', 'special_title': '', 'permission': 'MEMBER', 'join_timestamp': 1574145563, 'last_speak_timestamp': 1704724585, 'mute_time_remaining': 0, 'group': {'id': , 'name': '', 'permission': 'MEMBER'}}, 'quote': None, 'to_me': True} 01-08 22:36:25 [DEBUG] nonebot | Checking for matchers in priority 1... 01-08 22:36:25 [INFO] nonebot | Event will be handled by Matcher(type='message', module=nonebot_plugin_bilichat.commands.subs, lineno=15) 01-08 22:36:25 [DEBUG] nonebot | Running Matcher(type='message', module=nonebot_plugin_bilichat.commands.subs, lineno=15) 01-08 22:36:25 [DEBUG] nonebot | Running handler Dependent(call=check_sub) 01-08 22:36:25 [DEBUG] nonebot | Handler Dependent(call=check_sub) skipped 01-08 22:36:25 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_bilichat.commands.subs, lineno=15) running complete 01-08 22:36:25 [DEBUG] nonebot | Checking for matchers completed

插件的配置项

DRIVER=~fastapi+~websockets HOST=127.0.0.1 PORT=17501 LOG_LEVEL=DEBUG SUPERUSERS=["***"] COMMAND_START=["/"]

MIRAI_HOST=localhost MIRAI_PORT=17500 VERIFY_KEY= MIRAI_QQ=[]

bilichat_cd_time = 120 bilichat_neterror_retry = 3 bilichat_use_browser = True bilichat_text_fonts = "yahei" bilichat_webui_path = "bilichat" bilichat_cache_serive = "json" bilichat_dynamic = True bilichat_basic_info = True bilichat_whitelist = ["***"]

截图或日志

echo插件正常回复,bilichat无回复 4 1 2

Well2333 commented 6 months ago

指令部分由 指令前缀 和 指令名 组成,其中 指令前缀 包含 COMMAND_START bilichat_cmd_start COMMAND_SEP 三部分,默认的 指令前缀 为 /bilichat. ,即完整的指令为 /bilichat.xxx

https://github.com/Well2333/nonebot-plugin-bilichat?tab=readme-ov-file#%E6%8C%87%E4%BB%A4%E8%A1%A8

请仔细阅读 readme 后再发布 issue

Plandres commented 6 months ago

在使用"/bilichat.sub"和“/bilichat.check”后依然无回复,输入“/bilichat.qrlogin”后台有报错

01-09 13:28:03 [ERROR] nonebot | Running Matcher(type='message', module=nonebot_plugin_bilichat.commands.login, lineno=56) failed. Traceback (most recent call last): File "", line 15, in File "/home/ubuntu/bot/bilichat/.venv/lib/python3.10/site-packages/nonebot/init.py", line 331, in run get_driver().run(*args, kwargs) File "/home/ubuntu/bot/bilichat/.venv/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 189, in run uvicorn.run( File "/home/ubuntu/bot/bilichat/.venv/lib/python3.10/site-packages/uvicorn/main.py", line 587, in run server.run() File "/home/ubuntu/bot/bilichat/.venv/lib/python3.10/site-packages/uvicorn/server.py", line 61, 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 "/home/ubuntu/bot/bilichat/.venv/lib/python3.10/site-packages/nonebot/message.py", line 476, in check_and_run_matcher await _run_matcher( File "/home/ubuntu/bot/bilichat/.venv/lib/python3.10/site-packages/nonebot/message.py", line 428, in _run_matcher await matcher.run(bot, event, state, stack, dependency_cache) File "/home/ubuntu/bot/bilichat/.venv/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 846, in run await self.simple_run(bot, event, state, stack, dependency_cache) File "/home/ubuntu/bot/bilichat/.venv/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 821, in simple_run await handler( File "/home/ubuntu/bot/bilichat/.venv/lib/python3.10/site-packages/nonebot/dependencies/init.py", line 113, in call return await cast(Callable[..., Awaitable[R]], self.call)(values) File "/home/ubuntu/bot/bilichat/.venv/lib/python3.10/site-packages/nonebot_plugin_bilichat/commands/login.py", line 91, in bili_qrcode_login await MessageFactory(Image(data)).send() File "/home/ubuntu/bot/bilichat/.venv/lib/python3.10/site-packages/nonebot_plugin_saa/abstract_factories.py", line 301, in send
target = extract_target(event) File "/home/ubuntu/bot/bilichat/.venv/lib/python3.10/site-packages/nonebot_plugin_saa/registries/platform_send_target.py", line 276, in extract_target raise RuntimeError(f"event {event.class} not supported") RuntimeError: event <class 'nonebot.adapters.mirai2.event.message.GroupMessage'> not supported

1 2

Well2333 commented 6 months ago

插件的指令部分使用的是saa进行跨平台适配,但saa未支持mirai,readme中标注是错误的,将在下个版本修正。

也就是说,目前本插件在 mirai 适配器中只能视频解析。如果有需求可以考虑使用 nonebot-plugin-all4one 或其他类似的项目进行协议转换进行使用,或在 saa 中提出添加 mirai 支持的请求。