cscs181 / QQ-GitHub-Bot

GitHub Bot for QQ
MIT License
279 stars 42 forks source link

Bug: 只使用私域Bot,在频道推送消息的选择目标Bot时出现异常 #88

Open 17TheWord opened 4 weeks ago

17TheWord commented 4 weeks ago

如题,只使用一个Bot且为私域Bot,接收到GitHub的推送后在 get_target_bot 阶段出现异常

错误日志

09-19 21:46:02 [INFO] uvicorn | 140.82.115.84:26578 - "POST /github/webhooks/xxxxxx HTTP/1.1" 200
09-19 21:46:02 [SUCCESS] nonebot | GitHub 351456 | [star.created]: StarCreated xxxxxxxxxx from sender xxxxxx in repository xxxxxx/xxxxxx
09-19 21:46:02 [INFO] nonebot | Event will be handled by Matcher(type='', module=src.plugins.github.webhooks.star, lineno=33)
09-19 21:46:02 [WARNING] github:star | Send message to subscriber failed: coroutine raised StopIteration
Traceback (most recent call last):
  File "/app/src/providers/platform/extractors/qq.py", line 157, in get_target_bot
    public_bot = next(bot for bot in bots if not bot.bot_info.intent.guild_messages)
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/gunicorn", line 8, in <module>
    sys.exit(run())
  File "/usr/local/lib/python3.11/site-packages/gunicorn/app/wsgiapp.py", line 66, in run
    WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]", prog=prog).run()
  File "/usr/local/lib/python3.11/site-packages/gunicorn/app/base.py", line 235, in run
    super().run()
  File "/usr/local/lib/python3.11/site-packages/gunicorn/app/base.py", line 71, in run
    Arbiter(self).run()
  File "/usr/local/lib/python3.11/site-packages/gunicorn/arbiter.py", line 201, in run
    self.manage_workers()
  File "/usr/local/lib/python3.11/site-packages/gunicorn/arbiter.py", line 570, in manage_workers
    self.spawn_workers()
  File "/usr/local/lib/python3.11/site-packages/gunicorn/arbiter.py", line 641, in spawn_workers
    self.spawn_worker()
  File "/usr/local/lib/python3.11/site-packages/gunicorn/arbiter.py", line 608, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python3.11/site-packages/uvicorn/workers.py", line 75, in init_process
    super().init_process()
  File "/usr/local/lib/python3.11/site-packages/gunicorn/workers/base.py", line 143, in init_process
    self.run()
  File "/usr/local/lib/python3.11/site-packages/uvicorn/workers.py", line 107, in run
    return asyncio.run(self._serve())
  File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
  File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
  File "/usr/local/lib/python3.11/site-packages/nonebot/message.py", line 476, in check_and_run_matcher
    await _run_matcher(
  File "/usr/local/lib/python3.11/site-packages/nonebot/message.py", line 428, in _run_matcher
    await matcher.run(bot, event, state, stack, dependency_cache)
  File "/usr/local/lib/python3.11/site-packages/nonebot/internal/matcher/matcher.py", line 850, in run
    await self.simple_run(bot, event, state, stack, dependency_cache)
  File "/usr/local/lib/python3.11/site-packages/nonebot/internal/matcher/matcher.py", line 825, in simple_run
    await handler(
  File "/usr/local/lib/python3.11/site-packages/nonebot/dependencies/__init__.py", line 94, in __call__
    return await cast(Callable[..., Awaitable[R]], self.call)(**values)
> File "/app/src/plugins/github/webhooks/star.py", line 59, in handle_star_event
    await send_subscriber_text(target.to_subscriber_info(), message, tag)
  File "/app/src/plugins/github/webhooks/_dependencies.py", line 74, in send_subscriber_text
    bot = await get_target_bot(target_info)
  File "/app/src/providers/platform/extractors/__init__.py", line 72, in get_target_bot
    return await extractor.get_target_bot(target)
RuntimeError: coroutine raised StopIteration
09-19 21:46:03 [INFO] nonebot | Matcher(type='', module=src.plugins.github.webhooks.star, lineno=33) running complete