ieew / nonebot_adapter_mirai2

nonebot2 的三方 adapter,用以为 nonebot2 提供 MiraiApiHttp2 协议支持
https://ieew.github.io/nonebot_adapter_mirai2/
GNU Affero General Public License v3.0
20 stars 6 forks source link

异常消息导致的IndexError #56

Open Well2333 opened 1 year ago

Well2333 commented 1 year ago

适配器版本 version = "0.0.22"

mirai-api-http v2.9.1 Mirai consosle 2.14.0 iTXTech MCL Version: 2.1.2-61c8bd8

2023-05-09 22:27:39 V/Bot.1943125575: Well404(1070330078) -> /start
2023-05-09 22:27:39 V/Bot.1943125575: Friend(1070330078) <- @1070330078
2023-05-09 22:28:54 V/Bot.1943125575: [test(705321823)] Well404(1070330078) -> /start
2023-05-09 22:28:54 V/Bot.1943125575: Group(705321823) <- [mirai:at:1070330078]
2023-05-09 22:28:54 V/Bot.1943125575: Well404(1070330078) -> at个人 -- 22:28:54\ntest(705321823)\n403 Forbidden(1943125575)
2023-05-09 22:28:54 V/Bot.1943125575: Well404(1070330078) -> 
05-09 22:27:39 [SUCCESS] nonebot | mirai2 1943125575 | [FriendMessage]: {'self_id': 1943125575, 'type': 'FriendMessage', 'message_chain': [{'type': 'Plain', 'data': {'text': '/start'}}], 'source': {'id': 48923, 'time': '2023-05-09T14:27:38+00:00'}, 'sender': {'id': 1070330078, 'nickname': 'Well404', 'remark': 'Well404'}, 'quote': None}
05-09 22:27:39 [DEBUG] nonebot | Checking for matchers in priority 1...
05-09 22:27:39 [INFO] nonebot | Event will be handled by Matcher(type='message', module=func_tests)
05-09 22:27:39 [DEBUG] nonebot | Running Matcher(type='message', module=func_tests)
05-09 22:27:39 [DEBUG] nonebot | Running handler Dependent(call=_)
05-09 22:27:39 [INFO] nonebot | Matcher(type='message', module=func_tests) running complete
05-09 22:27:39 [DEBUG] nonebot | Checking for matchers completed
05-09 22:28:54 [SUCCESS] nonebot | mirai2 1943125575 | [GroupMessage]: {'self_id': 1943125575, 'type': 'GroupMessage', 'message_chain': [{'type': 'Plain', 'data': {'text': '/start'}}], 'source': {'id': 18989, 'time': '2023-05-09T14:28:54+00:00'}, 'sender': {'id': 1070330078, 'name': 'Well404', 'special_title': '', 'permission': 'OWNER', 'join_timestamp': 1664369051, 'last_speak_timestamp': 1683642534, 'mute_time_remaining': 0, 'group': {'id': 705321823, 'name': 'test', 'permission': 'MEMBER'}}, 'quote': None, 'to_me': False}
05-09 22:28:54 [DEBUG] nonebot | Checking for matchers in priority 1...
05-09 22:28:54 [INFO] nonebot | Event will be handled by Matcher(type='message', module=func_tests)
05-09 22:28:54 [DEBUG] nonebot | Running Matcher(type='message', module=func_tests)
05-09 22:28:54 [DEBUG] nonebot | Running handler Dependent(call=_)
05-09 22:28:54 [INFO] nonebot | Matcher(type='message', module=func_tests) running complete
05-09 22:28:54 [DEBUG] nonebot | Checking for matchers completed
05-09 22:28:54 [SUCCESS] nonebot | mirai2 1943125575 | [FriendMessage]: {'self_id': 1943125575, 'type': 'FriendMessage', 'message_chain': [], 'source': {'id': 62270, 'time': '2023-05-09T14:28:54+00:00'}, 'sender': {'id': 1070330078, 'nickname': 'Well404', 'remark': 'Well404'}, 'quote': None}
05-09 22:28:54 [WARNING] nonebot | Error while parsing command for event
Traceback (most recent call last):
  File "c:\github\nonebot-plugin-segbuilder\bot.py", line 18, in <module>
    nonebot.run()
  File "c:\github\nonebot-plugin-segbuilder\.venv\lib\site-packages\nonebot\drivers\fastapi.py", line 198, in run
    uvicorn.run(
  File "c:\github\nonebot-plugin-segbuilder\.venv\lib\site-packages\uvicorn\main.py", line 578, in run
    server.run()
  File "c:\github\nonebot-plugin-segbuilder\.venv\lib\site-packages\uvicorn\server.py", line 
61, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "c:\users\well404\appdata\local\programs\python\python38\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "c:\users\well404\appdata\local\programs\python\python38\lib\asyncio\base_events.py", 
line 603, in run_until_complete
    self.run_forever()
  File "c:\users\well404\appdata\local\programs\python\python38\lib\asyncio\windows_events.py", line 316, in run_forever
    super().run_forever()
  File "c:\users\well404\appdata\local\programs\python\python38\lib\asyncio\base_events.py", 
line 570, in run_forever
    self._run_once()
  File "c:\users\well404\appdata\local\programs\python\python38\lib\asyncio\base_events.py", 
line 1859, in _run_once
    handle._run()
  File "c:\users\well404\appdata\local\programs\python\python38\lib\asyncio\events.py", line 
81, in _run
    self._context.run(self._callback, *self._args)
  File "c:\github\nonebot-plugin-segbuilder\.venv\lib\site-packages\nonebot\adapters\mirai2\utils.py", line 80, in process_event
    await handle_event(bot, event)
> File "c:\github\nonebot-plugin-segbuilder\.venv\lib\site-packages\nonebot\message.py", line 280, in handle_event
    TrieRule.get_value(bot, event, state)
  File "c:\github\nonebot-plugin-segbuilder\.venv\lib\site-packages\nonebot\rule.py", line 107, in get_value
    message_seg: MessageSegment = message[0]
  File "c:\github\nonebot-plugin-segbuilder\.venv\lib\site-packages\nonebot\internal\adapter\message.py", line 254, in __getitem__
    return super().__getitem__(arg1)
IndexError: list index out of range

初步断定可能是 mirai 方面的问题,先发个issue留个记录