Mar-7th / March7th

March7th - 基于 NoneBot2 的崩坏:星穹铁道多功能机器人 Honkai: Star Rail bot based on NoneBot2.
https://march7th.xyz/zh/
GNU Affero General Public License v3.0
119 stars 11 forks source link

go-cqhttp 部署方式频道消息报错:ValueError: Event has no message! #25

Open sgpublic opened 11 months ago

sgpublic commented 11 months ago

日志如下:

11-27 11:58:02 [SUCCESS] nonebot | OneBot V11 3206547851 | [message]: {'time': 1701086280, 'self_id': xxx, 'post_type': 'message', 'self_tiny_id': 'xxxx', 'message_type': 'guild', 'guild_id': 'xxxx', 'sub_type': 'channel', 'sender': {'nickname': '忆丶距', 'tiny_id': 'xxxx', 'user_id': xxxx}, 'message': 'srhelp', 'channel_id': 'xxxx', 'user_id': 'xxxx', 'message_id': 'xxxx'}
11-27 11:58:02 [WARNING] nonebot | Error while parsing command for event
Traceback (most recent call last):
  File "<string>", line 19, in <module>
  File "/home/poetry-runner/.cache/pypoetry/virtualenvs/march7th-9TtSrW0h-py3.11/lib/python3.11/site-packages/nonebot/__init__.py", line 331, in run
    get_driver().run(*args, **kwargs)
  File "/home/poetry-runner/.cache/pypoetry/virtualenvs/march7th-9TtSrW0h-py3.11/lib/python3.11/site-packages/nonebot/drivers/fastapi.py", line 201, in run
    uvicorn.run(
  File "/home/poetry-runner/.cache/pypoetry/virtualenvs/march7th-9TtSrW0h-py3.11/lib/python3.11/site-packages/uvicorn/main.py", line 587, in run
    server.run()
  File "/home/poetry-runner/.cache/pypoetry/virtualenvs/march7th-9TtSrW0h-py3.11/lib/python3.11/site-packages/uvicorn/server.py", line 61, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
  File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
  File "/home/poetry-runner/.cache/pypoetry/virtualenvs/march7th-9TtSrW0h-py3.11/lib/python3.11/site-packages/nonebot/adapters/onebot/v11/bot.py", line 198, in handle_event
    await handle_event(self, event)
> File "/home/poetry-runner/.cache/pypoetry/virtualenvs/march7th-9TtSrW0h-py3.11/lib/python3.11/site-packages/nonebot/message.py", line 524, in handle_event
    TrieRule.get_value(bot, event, state)
  File "/home/poetry-runner/.cache/pypoetry/virtualenvs/march7th-9TtSrW0h-py3.11/lib/python3.11/site-packages/nonebot/rule.py", line 104, in get_value
    message = event.get_message()
  File "/home/poetry-runner/.cache/pypoetry/virtualenvs/march7th-9TtSrW0h-py3.11/lib/python3.11/site-packages/nonebot/adapters/onebot/v11/event.py", line 49, in get_message
    raise ValueError("Event has no message!")
ValueError: Event has no message!

个人理解似乎是 nonebot-plugin-send-anything-anywhere 的问题,但鄙人对 python 不是很熟就交由大佬判断了(doge

mobyw commented 11 months ago

nonebot-plugin-send-anything-anywhere 的 OneBot v11 不支持 QQ 频道,可以使用 QQ 频道适配器或等 MountainDash/nonebot-plugin-send-anything-anywhere #105 合并后使用 QQ 适配器