Utmost-Happiness-Planet / nonebot-plugin-repeater

auto +1 ✨
GNU General Public License v3.0
36 stars 10 forks source link

出现图片+文字的消息就会报错 #14

Closed Zzzzzzouhang closed 2 years ago

Zzzzzzouhang commented 2 years ago
06-25 10:20:29 [SUCCESS] nonebot | ONEBOT V11 1950979136 | [message.group.normal]: Message -1945135220 from 2338127903@[群:933121309] "[CQ:image,file=ff5f07670c8f03c4014f37722bc2a605.image,subType=0,url=https://gchat.qpic.cn/gchatpic_new/2338127903/933121309-2759923286-FF5F07670C8F03C4014F37722BC2A605/0?term=3]复读机挂了"
06-25 10:20:29 [INFO] nonebot | Event will be handled by <Matcher from nonebot_plugin_repeater, type=message, priority=10, temp=False>
06-25 10:20:29 [INFO] nonebot | Matcher <Matcher from nonebot_plugin_repeater, type=message, priority=10, temp=False> running complete
06-25 10:20:29 [ERROR] nonebot | Running matcher <Matcher from nonebot_plugin_repeater, type=message, priority=10, temp=False> failed.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/root/miniconda3/lib/python3.9/multiprocessing/spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "/root/miniconda3/lib/python3.9/multiprocessing/spawn.py", line 129, in _main
    return self._bootstrap(parent_sentinel)
  File "/root/miniconda3/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/root/miniconda3/lib/python3.9/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/root/miniconda3/lib/python3.9/site-packages/uvicorn/subprocess.py", line 76, in subprocess_started
    target(sockets=sockets)
  File "/root/miniconda3/lib/python3.9/site-packages/uvicorn/server.py", line 60, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "/root/miniconda3/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/root/miniconda3/lib/python3.9/site-packages/nonebot/message.py", line 146, in _check_matcher
    await _run_matcher(Matcher, bot, event, state, stack, dependency_cache)
> File "/root/miniconda3/lib/python3.9/site-packages/nonebot/message.py", line 196, in _run_matcher
    await matcher.run(bot, event, state, stack, dependency_cache)
  File "/root/miniconda3/lib/python3.9/site-packages/nonebot/internal/matcher.py", line 668, in run
    await self.simple_run(bot, event, state, stack, dependency_cache)
  File "/root/miniconda3/lib/python3.9/site-packages/nonebot/internal/matcher.py", line 635, in simple_run
    await handler(
  File "/root/miniconda3/lib/python3.9/site-packages/nonebot/dependencies/__init__.py", line 92, in __call__
    return await self.call(**values)
  File "/root/miniconda3/lib/python3.9/site-packages/nonebot_plugin_repeater/__init__.py", line 32, in repeater
    message, raw_message = messagePreprocess(str(event.message))
  File "/root/miniconda3/lib/python3.9/site-packages/nonebot_plugin_repeater/__init__.py", line 21, in messagePreprocess
    contained_images.update({i: [re.findall(r'\[.*url=(.*?),.*]', i)[0], re.findall(r'\[.*file=(.*?),.*]', i)[0]]})
IndexError: list index out of range

原消息是个表情包+图 image

ninthseason commented 2 years ago

原因是cqcode参数顺序又变了,导致原来的正则表达式失效。 干脆一劳永逸换了一个鲁棒性更好的表达式。

已修复。请更新插件至最新版本。

Zzzzzzouhang commented 2 years ago

感谢,以及没问题了