bot-ssttkkl / nonebot-plugin-pixivbot

NoneBot插件,发送随机Pixiv插画、画师更新推送、定时订阅推送……
MIT License
112 stars 3 forks source link

请求多张图片时失败,控制R-18的命令无响应 #132

Closed SnowMoonSS closed 1 year ago

SnowMoonSS commented 1 year ago

py:3.10.8 OS:Debian x64

nb-cli 1.0.4 nonebot-adapter-onebot 2.2.1 nonebot-plugin-access-control 0.2.3 nonebot-plugin-apscheduler 0.2.0 nonebot-plugin-datastore 0.4.0 nonebot-plugin-localstore 0.2.0 nonebot-plugin-pixivbot 1.7.0.post2 nonebot2 2.0.0rc3

配置文件:

DRIVER=~fastapi

HOST=127.0.0.1
PORT=8082
LOG_LEVEL=INFO
NICKNAME=["Alice"]
SUPERUSER=["123456789"]
COMMAND_START=["/", ""]

#nonebot-plugin-pixivbot
pixiv_refresh_token=*****************
pixiv_block_tags=["NovelAI"]
pixiv_block_action=completely_block
pixiv_query_cooldown=10
pixiv_max_item_per_query=5

#nonebot-plugin-access-control
ACCESS_CONTROL_AUTO_PATCH_ENABLED=true

已安装的只有nonebot-plugin-pixivbotnonebot-plugin-access-control 在私聊和群聊中使用ac/ac指令均无任何反应,无法控制R-18

不管是”来3张图“还是”来5张图“或者是下面日志里的”来2张图“,都会报这个错,但仅仅是”来张图“不会报错 以下是日志

[2023-02-10 15:48:50] 02-10 15:48:49 [SUCCESS] nonebot | OneBot V11 1234567890 | [message.private.friend]: Message 305350647 from 123456789 '来2张图'
[2023-02-10 15:48:50] 02-10 15:48:49 [INFO] nonebot | Event will be handled by Matcher(type='message', module=nonebot_plugin_pixivbot.handler.common.random_recommended_illust)
[2023-02-10 15:48:50] 02-10 15:48:49 [INFO] nonebot_plugin_pixivbot | [mediator] recommended_illusts cache_strategy=NORMAL
[2023-02-10 15:48:50] 02-10 15:48:49 [INFO] nonebot_plugin_pixivbot | [local] recommended_illusts
[2023-02-10 15:48:50] 02-10 15:48:49 [INFO] nonebot_plugin_pixivbot | [pixiv_service] choice [95841125, 80168605]
[2023-02-10 15:48:50] 02-10 15:48:49 [INFO] nonebot_plugin_pixivbot | [local] got 1000 illusts, illust_detail of 0 are missed
[2023-02-10 15:48:50] 02-10 15:48:49 [INFO] nonebot_plugin_pixivbot | [mediator] image 95841125[0] cache_strategy=NORMAL
[2023-02-10 15:48:50] 02-10 15:48:49 [INFO] nonebot_plugin_pixivbot | [local] image 95841125
[2023-02-10 15:48:50] 02-10 15:48:49 [INFO] nonebot_plugin_pixivbot | [mediator] image 80168605[0] cache_strategy=NORMAL
[2023-02-10 15:48:50] 02-10 15:48:49 [INFO] nonebot_plugin_pixivbot | [local] image 80168605
[2023-02-10 15:48:50] 02-10 15:48:49 [INFO] nonebot_plugin_pixivbot | [mediator] no cache or cache expired
[2023-02-10 15:48:50] 02-10 15:48:49 [INFO] nonebot_plugin_pixivbot | [remote] image 95841125
[2023-02-10 15:48:50] 02-10 15:48:49 [INFO] nonebot_plugin_pixivbot | [mediator] no cache or cache expired
[2023-02-10 15:48:50] 02-10 15:48:49 [INFO] nonebot_plugin_pixivbot | [remote] image 80168605
[2023-02-10 15:48:51] 02-10 15:48:50 [INFO] nonebot_plugin_pixivbot | [local] update image 80168605 (update_time=2023-02-10 07:48:50.967331+00:00)
[2023-02-10 15:48:52] 02-10 15:48:51 [INFO] nonebot_plugin_pixivbot | [local] update image 95841125 (update_time=2023-02-10 07:48:51.512486+00:00)
[2023-02-10 15:48:52] 02-10 15:48:51 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_pixivbot.handler.common.random_recommended_illust) running complete
[2023-02-10 15:48:52] 02-10 15:48:51 [ERROR] nonebot | Running Matcher(type='message', module=nonebot_plugin_pixivbot.handler.common.random_recommended_illust) failed.
[2023-02-10 15:48:52] Traceback (most recent call last):
[2023-02-10 15:48:52]   File "<string>", line 15, in <module>
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/nonebot/__init__.py", line 273, in run
[2023-02-10 15:48:52]     get_driver().run(*args, **kwargs)
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 187, in run
[2023-02-10 15:48:52]     uvicorn.run(
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/uvicorn/main.py", line 569, in run
[2023-02-10 15:48:52]     server.run()
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/uvicorn/server.py", line 60, in run
[2023-02-10 15:48:52]     return asyncio.run(self.serve(sockets=sockets))
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/3.10.8/lib/python3.10/asyncio/runners.py", line 44, in run
[2023-02-10 15:48:52]     return loop.run_until_complete(main)
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/nonebot/message.py", line 141, in _check_matcher
[2023-02-10 15:48:52]     await _run_matcher(Matcher, bot, event, state, stack, dependency_cache)
[2023-02-10 15:48:52] > File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/nonebot/message.py", line 187, in _run_matcher
[2023-02-10 15:48:52]     await matcher.run(bot, event, state, stack, dependency_cache)
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 732, in run
[2023-02-10 15:48:52]     await self.simple_run(bot, event, state, stack, dependency_cache)
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 707, in simple_run
[2023-02-10 15:48:52]     await handler(
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/nonebot/dependencies/__init__.py", line 108, in __call__
[2023-02-10 15:48:52]     return await cast(Callable[..., Awaitable[R]], self.call)(**values)
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/nonebot_plugin_pixivbot/handler/common/random_recommended_illust.py", line 37, in on_match
[2023-02-10 15:48:52]     await self.handle(count=get_count(state), post_dest=post_dest)
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/nonebot_plugin_pixivbot/handler/base.py", line 99, in handle
[2023-02-10 15:48:52]     await self.interceptor.intercept(self._parse_args_and_actual_handle, *args,
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/nonebot_plugin_pixivbot/handler/interceptor/combined_interceptor.py", line 45, in intercept
[2023-02-10 15:48:52]     await self.x.intercept(
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/nonebot_plugin_pixivbot/handler/interceptor/combined_interceptor.py", line 45, in intercept
[2023-02-10 15:48:52]     await self.x.intercept(
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/nonebot_plugin_pixivbot/handler/interceptor/combined_interceptor.py", line 45, in intercept
[2023-02-10 15:48:52]     await self.x.intercept(
[2023-02-10 15:48:52]   [Previous line repeated 3 more times]
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/nonebot_plugin_pixivbot/handler/interceptor/default_error_interceptor.py", line 32, in intercept
[2023-02-10 15:48:52]     raise e
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/nonebot_plugin_pixivbot/handler/interceptor/default_error_interceptor.py", line 22, in intercept
[2023-02-10 15:48:52]     await wrapped_func(*args, post_dest=post_dest, silently=silently, **kwargs)
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/nonebot_plugin_pixivbot/handler/interceptor/permission_interceptor.py", line 34, in intercept
[2023-02-10 15:48:52]     await wrapped_func(*args, post_dest=post_dest, silently=silently, **kwargs)
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/nonebot_plugin_pixivbot/handler/interceptor/permission_interceptor.py", line 34, in intercept
[2023-02-10 15:48:52]     await wrapped_func(*args, post_dest=post_dest, silently=silently, **kwargs)
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/nonebot_plugin_pixivbot/handler/interceptor/timeout_interceptor.py", line 21, in intercept
[2023-02-10 15:48:52]     await wait_for(wrapped_func(*args, post_dest=post_dest, silently=silently, **kwargs),
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/3.10.8/lib/python3.10/asyncio/tasks.py", line 445, in wait_for
[2023-02-10 15:48:52]     return fut.result()
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/nonebot_plugin_pixivbot/handler/interceptor/loading_prompt_interceptor.py", line 33, in intercept
[2023-02-10 15:48:52]     await wrapped_func(*args, post_dest=post_dest, silently=silently, **kwargs)
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/nonebot_plugin_pixivbot/handler/interceptor/record_req_interceptor.py", line 20, in intercept
[2023-02-10 15:48:52]     await wrapped_func(*args, post_dest=post_dest, silently=silently, **kwargs)
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/nonebot_plugin_pixivbot/handler/interceptor/permission_interceptor.py", line 34, in intercept
[2023-02-10 15:48:52]     await wrapped_func(*args, post_dest=post_dest, silently=silently, **kwargs)
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/nonebot_plugin_pixivbot/handler/base.py", line 130, in _parse_args_and_actual_handle
[2023-02-10 15:48:52]     await self.actual_handle(post_dest=post_dest, silently=silently, **kwargs)
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/nonebot_plugin_pixivbot/handler/common/random_recommended_illust.py", line 49, in actual_handle
[2023-02-10 15:48:52]     await self.post_illusts(illusts,
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/nonebot_plugin_pixivbot/handler/base.py", line 70, in post_illusts
[2023-02-10 15:48:52]     await self.postman_manager.send_illusts(model, post_dest=post_dest)
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/nonebot_plugin_pixivbot/handler/recorder.py", line 101, in send_illusts
[2023-02-10 15:48:52]     await self.delegation.send_illusts(model, post_dest=post_dest)
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/nonebot_plugin_pixivbot/protocol_dep/postman.py", line 40, in send_illusts
[2023-02-10 15:48:52]     return await self[post_dest.adapter].send_illusts(model, post_dest=post_dest)
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/nonebot_plugin_pixivbot_onebot_v11/protocol_dep/postman.py", line 84, in send_illusts
[2023-02-10 15:48:52]     await post_dest.post(messages)
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/nonebot_plugin_pixivbot_onebot_v11/protocol_dep/post_dest.py", line 49, in post
[2023-02-10 15:48:52]     await self.post_multiple(message)
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/nonebot_plugin_pixivbot_onebot_v11/protocol_dep/post_dest.py", line 89, in post_multiple
[2023-02-10 15:48:52]     await self.bot.send_private_forward_msg(
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/nonebot/internal/adapter/bot.py", line 120, in call_api
[2023-02-10 15:48:52]     raise exception
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/nonebot/internal/adapter/bot.py", line 98, in call_api
[2023-02-10 15:48:52]     result = await self.adapter._call_api(self, api, **data)
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/nonebot/adapters/onebot/v11/adapter.py", line 132, in _call_api
[2023-02-10 15:48:52]     return handle_api_result(await self._result_store.fetch(seq, timeout))
[2023-02-10 15:48:52]   File "/home/snowmoonss/.pyenv/versions/pixivbot/lib/python3.10/site-packages/nonebot/adapters/onebot/v11/utils.py", line 58, in handle_api_result
[2023-02-10 15:48:52]     raise ActionFailed(**result)
[2023-02-10 15:48:52] nonebot.adapters.onebot.v11.exception.ActionFailed: ActionFailed(status='failed', retcode=103, data=None, echo='2')
SnowMoonSS commented 1 year ago

看看榜指令也是这个报错

ssttkkl commented 1 year ago

多张图片时会用合并转发消息发送,可能因为号被风控无法发送转发消息。之后的版本计划添加配置项决定是通过合并转发消息发送还是发送多条消息。 控制R-18的命令只响应SUPERUSERS,如果不是这个原因那我也不知道什么原因了()

ssttkkl commented 1 year ago

多张图片时会用合并转发消息发送,可能因为号被风控无法发送转发消息。之后的版本计划添加配置项决定是通过合并转发消息发送还是发送多条消息。 控制R-18的命令只响应SUPERUSERS,如果不是这个原因那我也不知道什么原因了()

1.7.1版本增加了pixiv_onebot_send_forward_message配置项,设置为never时发送多条消息

SnowMoonSS commented 1 year ago

我似乎找到原因了,我用的这个onebot插件已经年久失修,甚至部分功能不完善,合并转发的功能不正常。该想办法迁移到mirai-api-http了…… K SV1K%PSTVP @AQQR05__N

https://github.com/yyuueexxiinngg/onebot-kotlin/issues/111

ssttkkl commented 1 year ago

我没有做mirai adapter的适配,mirai-api-http大概率是用不了的 把合并转发关了凑合用下吧()

SnowMoonSS commented 1 year ago

草,原来还要专门适配的,我还以为一份代码,想用什么协议直接换adapter就行了…… ac指令没反应的问题是我傻逼了,SUPERUSERS写成SUPERUSER了……离谱的是它居然没报错,以前配置文件里不加SUPERUSERS这个变量直接报错,没想到变量名错了也不报错…… B}S`FB)~I2(0_$6OJE%{GY8