Closed ab-Royo closed 1 year ago
安装插件后只能回应戳戳,发送文字/图片就会出现以下报错
配置文件
# 自定义戳戳群聊事件 # 机器人名称 bot_nickname = 'ab' poke_send_pic = False poke_send_poke = True poke_send_text = True poke_send_acc = False
报错
08-01 18:49:13 [SUCCESS] nonebot | OneBot V11 329...27 | [notice.notify.poke]: {'time': 1690886953, 'self_id': 329...27, 'post_type': 'notice', 'notice_type': 'notify', 'sub_type': 'poke', 'user_id': 619...1, 'group_id': 210...7, 'target_id': 329...27, 'sender_id': 619...1} 08-01 18:49:13 [INFO] nonebot | Event will be handled by Matcher(type='notice', module=nonebot_plugin_poke) 08-01 18:49:13 [SUCCESS] nonebot_plugin_poke | 反击戳戳 08-01 18:49:14 [SUCCESS] nonebot_plugin_poke | 发送文字 08-01 18:49:14 [INFO] nonebot | Matcher(type='notice', module=nonebot_plugin_poke) running complete 08-01 18:49:14 [ERROR] nonebot | Running Matcher(type='notice', module=nonebot_plugin_poke) failed. Traceback (most recent call last): File "<string>", line 17, in <module> File "C:\Users\Administrator\Desktop\QBot\main06\.venv\lib\site-packages\nonebot\__init__.py", line 333, in run get_driver().run(*args, **kwargs) File "C:\Users\Administrator\Desktop\QBot\main06\.venv\lib\site-packages\nonebot\drivers\fastapi.py", line 199, in run uvicorn.run( File "C:\Users\Administrator\Desktop\QBot\main06\.venv\lib\site-packages\uvicorn\main.py", line 578, in run server.run() File "C:\Users\Administrator\Desktop\QBot\main06\.venv\lib\site-packages\uvicorn\server.py", line 61, in run return asyncio.run(self.serve(sockets=sockets)) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\runners.py", line 44, in run return loop.run_until_complete(main) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 634, in run_until_complete self.run_forever() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\windows_events.py", line 321, in run_forever super().run_forever() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 601, in run_forever self._run_once() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 1905, in _run_once handle._run() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, *self._args) File "C:\Users\Administrator\Desktop\QBot\main06\.venv\lib\site-packages\nonebot\message.py", line 467, in check_and_run_matcher await _run_matcher( > File "C:\Users\Administrator\Desktop\QBot\main06\.venv\lib\site-packages\nonebot\message.py", line 419, in _run_matcher await matcher.run(bot, event, state, stack, dependency_cache) File "C:\Users\Administrator\Desktop\QBot\main06\.venv\lib\site-packages\nonebot\internal\matcher\matcher.py", line 759, in run await self.simple_run(bot, event, state, stack, dependency_cache) File "C:\Users\Administrator\Desktop\QBot\main06\.venv\lib\site-packages\nonebot\internal\matcher\matcher.py", line 734, in simple_run await handler( File "C:\Users\Administrator\Desktop\QBot\main06\.venv\lib\site-packages\nonebot\dependencies\__init__.py", line 108, in __call__ return await cast(Callable[..., Awaitable[R]], self.call)(**values) File "C:\Users\Administrator\Desktop\QBot\main06\.venv\lib\site-packages\nonebot_plugin_poke\__init__.py", line 68, in _ await poke_reply(event, matcher) File "C:\Users\Administrator\Desktop\QBot\main06\.venv\lib\site-packages\nonebot_plugin_poke\matcher.py", line 22, in poke_reply await matcher_pic_text(matcher) File "C:\Users\Administrator\Desktop\QBot\main06\.venv\lib\site-packages\nonebot_plugin_poke\matcher.py", line 37, in matcher_pic_text await pic_or_text(None, await text_send(), matcher) File "C:\Users\Administrator\Desktop\QBot\main06\.venv\lib\site-packages\nonebot_plugin_poke\utils.py", line 79, in text_send text_file_list: List[str] = (await f.read()).split("\n") File "C:\Users\Administrator\Desktop\QBot\main06\.venv\lib\site-packages\aiofiles\threadpool\utils.py", line 45, in method return (yield from self._loop.run_in_executor(self._executor, cb)) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\concurrent\futures\thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\codecs.py", line 322, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd4 in position 0: invalid continuation byte 08-01 18:49:14 [SUCCESS] nonebot | OneBot V11 329...27 | [notice.notify.poke]: {'time': 1690886954, 'self_id': 329...27, 'post_type': 'notice', 'notice_type': 'notify', 'sub_type': 'poke', 'user_id': 3292...27, 'group_id': 210...7, 'target_id': 619...1, 'sender_id': 329...27}
很怪,我没法复现这个报错
破案了!!! 在创建TXT文件时,系统默认编码是ANSI ,用UTF-8重新保存就正常了(
ANSI
UTF-8
安装插件后只能回应戳戳,发送文字/图片就会出现以下报错
配置文件
报错