10-11 00:28:56 [DEBUG] nonebot | Running handler Dependent(call=handle_message)
10-11 00:28:56 [DEBUG] nonebot | OneBot V11 | Calling API send_msg
10-11 00:28:56 [INFO] nonebot | Matcher(type='message', module=echomod_msgrelay.core, lineno=70) running complete
10-11 00:28:56 [ERROR] nonebot | Running Matcher(type='message', module=echomod_msgrelay.core, lineno=70) failed.
Traceback (most recent call last):
File "/home/jks15satoshi/.pyenv/versions/3.11.9/lib/python3.11/runpy.py", line 198, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/jks15satoshi/.pyenv/versions/3.11.9/lib/python3.11/runpy.py", line 88, in _run_code
exec(code, run_globals)
File "/home/jks15satoshi/.vscode/extensions/ms-python.debugpy-2024.10.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 39, in <module>
cli.main()
File "/home/jks15satoshi/.vscode/extensions/ms-python.debugpy-2024.10.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main
run()
File "/home/jks15satoshi/.vscode/extensions/ms-python.debugpy-2024.10.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284, in run_file
runpy.run_path(target, run_name="__main__")
File "/home/jks15satoshi/.vscode/extensions/ms-python.debugpy-2024.10.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 321, in run_path
return _run_module_code(code, init_globals, run_name,
File "/home/jks15satoshi/.vscode/extensions/ms-python.debugpy-2024.10.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 135, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/home/jks15satoshi/.vscode/extensions/ms-python.debugpy-2024.10.0-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code
exec(code, run_globals)
File "/home/jks15satoshi/Documents/Git/echodev/echobot/bot.py", line 18, in <module>
nonebot.run()
File "/home/jks15satoshi/Documents/Git/echodev/echobot/.venv/lib/python3.11/site-packages/nonebot/__init__.py", line 335, in run
get_driver().run(*args, **kwargs)
File "/home/jks15satoshi/Documents/Git/echodev/echobot/.venv/lib/python3.11/site-packages/nonebot/drivers/fastapi.py", line 186, in run
uvicorn.run(
File "/home/jks15satoshi/Documents/Git/echodev/echobot/.venv/lib/python3.11/site-packages/uvicorn/main.py", line 579, in run
server.run()
File "/home/jks15satoshi/Documents/Git/echodev/echobot/.venv/lib/python3.11/site-packages/uvicorn/server.py", line 65, in run
return asyncio.run(self.serve(sockets=sockets))
File "/home/jks15satoshi/.pyenv/versions/3.11.9/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
File "/home/jks15satoshi/.pyenv/versions/3.11.9/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
File "/home/jks15satoshi/Documents/Git/echodev/echobot/.venv/lib/python3.11/site-packages/nonebot/message.py", line 476, in check_and_run_matcher
await _run_matcher(
> File "/home/jks15satoshi/Documents/Git/echodev/echobot/.venv/lib/python3.11/site-packages/nonebot/message.py", line 428, in _run_matcher
await matcher.run(bot, event, state, stack, dependency_cache)
File "/home/jks15satoshi/Documents/Git/echodev/echobot/.venv/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 "/home/jks15satoshi/Documents/Git/echodev/echobot/.venv/lib/python3.11/site-packages/nonebot/internal/matcher/matcher.py", line 825, in simple_run
await handler(
File "/home/jks15satoshi/Documents/Git/echodev/echobot/.venv/lib/python3.11/site-packages/nonebot/dependencies/__init__.py", line 94, in __call__
return await cast(Callable[..., Awaitable[R]], self.call)(**values)
File "/home/jks15satoshi/Documents/Git/echodev/echomod/msgrelay/echomod_msgrelay/core.py", line 76, in handle_message
await message.send(target=Target("***"), bot=bot)
File "/home/jks15satoshi/Documents/Git/echodev/echobot/.venv/lib/python3.11/site-packages/nonebot_plugin_alconna/uniseg/message.py", line 1417, in send
res = await fn.send_to(target, bot, msg, **kwargs)
File "/home/jks15satoshi/Documents/Git/echodev/echobot/.venv/lib/python3.11/site-packages/nonebot_plugin_alconna/uniseg/adapters/onebot11/exporter.py", line 166, in send_to
return await bot.send_msg(message_type="group", group_id=int(_target.id), message=message, **kwargs)
File "/home/jks15satoshi/Documents/Git/echodev/echobot/.venv/lib/python3.11/site-packages/nonebot/internal/adapter/bot.py", line 122, in call_api
raise exception
File "/home/jks15satoshi/Documents/Git/echodev/echobot/.venv/lib/python3.11/site-packages/nonebot/internal/adapter/bot.py", line 97, in call_api
result = await self.adapter._call_api(self, api, **data)
File "/home/jks15satoshi/Documents/Git/echodev/echobot/.venv/lib/python3.11/site-packages/nonebot/adapters/onebot/v11/adapter.py", line 147, in _call_api
return handle_api_result(await self._result_store.fetch(seq, timeout))
File "/home/jks15satoshi/Documents/Git/echodev/echobot/.venv/lib/python3.11/site-packages/nonebot/adapters/onebot/v11/utils.py", line 58, in handle_api_result
raise ActionFailed(**result)
nonebot.adapters.onebot.v11.exception.ActionFailed: ActionFailed(status='failed', retcode=1200, data=None, message='Error: 消息体无法解析, 请检查是否发送了不支持的消息类型\n at OneBotMsgApi.sendMsgWithOb11UniqueId (file:///app/napcat/napcat.mjs:23955:13)\n at SendMsg._handle (file:///app/napcat/napcat.mjs:30716:56)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async SendMsg.websocketHandle (file:///app/napcat/napcat.mjs:30615:23)\n at async OB11ActiveWebSocketAdapter.handleMessage (file:///app/napcat/napcat.mjs:12843:21)', wording='Error: 消息体无法解析, 请检查是否发送了不支持的消息类型\n at OneBotMsgApi.sendMsgWithOb11UniqueId (file:///app/napcat/napcat.mjs:23955:13)\n at SendMsg._handle (file:///app/napcat/napcat.mjs:30716:56)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async SendMsg.websocketHandle (file:///app/napcat/napcat.mjs:30615:23)\n at async OB11ActiveWebSocketAdapter.handleMessage (file:///app/napcat/napcat.mjs:12843:21)', echo='1')
请确认:
Bug
问题
如题,一个简单的示例代码放在了复现部分。
经过调试发现
UniMessage
在进行消息类型转换时直接将 Discord 的自定义 emoji 消息段转为了 OneBot V11 的face
消息段:而 OneBot V11 的
face
消息段的 ID 有固定的取值范围,个人猜测应该是直接将 Discord 的自定 emoji ID 作为face
消息段 ID 导致了该消息段的无效。如何复现
同时连接一个 Discord 适配器 bot 和一个 OneBot V11 适配器 bot,创建一个事件响应器如下:
之后在 Discord 频道发送一个自定义 emoji 消息即会抛出
ActionFailed
异常。预期行为
或许将自定义 emoji 消息段作为图片消息处理比较合适?
使用环境:
日志/截图
个人认为敏感的 ID 数据使用
***
代替: