Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QQ群] 无法在接受消息指令时获取图片信息 #103

Closed
Yuelioi opened this issue Feb 26, 2024 · 0 comments · Fixed by #104
Closed

[QQ群] 无法在接受消息指令时获取图片信息 #103

Yuelioi opened this issue Feb 26, 2024 · 0 comments · Fixed by #104
Labels
bug Something isn't working

Comments

@Yuelioi
Copy link

Yuelioi commented Feb 26, 2024

环境

  • ubuntu
  • python3.10

详情

/测试 文字 (指令+文字没有问题)
/测试 [图片] (指令+图片报错)

报错如下所示

02-26 18:15:36 [WARNING] nonebot | QQ | Failed to parse event Dispatch(opcode=<Opcode.DISPATCH: 0>, data={'attachments': [{'content_type': 'image/jpeg', 'filename': 'CE56D93217731BCC87C554FA8AD7A8FF.jpg', 'height': 168, 'size': 3512, 'url': 'https://gchat.qpic.cn/gchatpic_new/761708854/761708854-2990635440-CE56D93217731BCC87C554FA8AD7A8FF/0?vuin=435826135&term=0&is_origin=2&is_ntv2=1', 'width': 138}], 'author': {'id': '73070094761266F31B985FB05EC75710', 'member_openid': '73070094761266F31B985FB05EC75710'}, 'content': ' /龙图 ', 'group_id': 'A9FA4B8E24CCD4DD6D18D0FAB2414F6A', 'group_openid': 'A9FA4B8E24CCD4DD6D18D0FAB2414F6A', 'id': 'ROBOT1.0_xQB7jM.LuoOeNiKmZ2M2af85kASWKlAQTpTuQyWbnX6rZVo5MJ16MNAABO7jRGuqgl.Qvlkq1iu9tB-Qgg2ZuA!!', 'timestamp': '2024-02-26T18:15:35+08:00'}, sequence=3, type='GROUP_AT_MESSAGE_CREATE', id='GROUP_AT_MESSAGE_CREATE:xqb7jmluooenikmz2m2acce6zlwjvfsrurvcnuhurruv957wseidnfe0ixfc6s')
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/root/.vscode-server/extensions/ms-python.debugpy-2024.3.10542134-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 39, in <module>
    cli.main()
  File "/root/.vscode-server/extensions/ms-python.debugpy-2024.3.10542134-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main
    run()
  File "/root/.vscode-server/extensions/ms-python.debugpy-2024.3.10542134-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 "/root/.vscode-server/extensions/ms-python.debugpy-2024.3.10542134-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 "/root/.vscode-server/extensions/ms-python.debugpy-2024.3.10542134-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 "/root/.vscode-server/extensions/ms-python.debugpy-2024.3.10542134-linux-x64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code
    exec(code, run_globals)
  File "/projects/nobot2/bot.py", line 66, in <module>
    nonebot.run()
  File "/projects/nobot2/.venv/lib/python3.10/site-packages/nonebot/__init__.py", line 333, in run
    get_driver().run(*args, **kwargs)
  File "/projects/nobot2/.venv/lib/python3.10/site-packages/nonebot/drivers/none.py", line 56, in run
    loop.run_until_complete(self._serve())
  File "/usr/lib/python3.10/asyncio/base_events.py", line 636, in run_until_complete
    self.run_forever()
  File "/usr/lib/python3.10/asyncio/base_events.py", line 603, in run_forever
    self._run_once()
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1909, in _run_once
    handle._run()
  File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/projects/nobot2/.venv/lib/python3.10/site-packages/nonebot/adapters/qq/adapter.py", line 181, in _forward_ws
    await self._loop(bot, ws)
> File "/projects/nobot2/.venv/lib/python3.10/site-packages/nonebot/adapters/qq/adapter.py", line 346, in _loop
    event = self.payload_to_event(payload)
  File "/projects/nobot2/.venv/lib/python3.10/site-packages/nonebot/adapters/qq/adapter.py", line 410, in payload_to_event
    return type_validate_python(EventClass, payload.data)
  File "/projects/nobot2/.venv/lib/python3.10/site-packages/nonebot/compat.py", line 202, in type_validate_python
    return TypeAdapter(type_).validate_python(data)
  File "/projects/nobot2/.venv/lib/python3.10/site-packages/pydantic/type_adapter.py", line 256, in validate_python
    return self.validator.validate_python(__object, strict=strict, from_attributes=from_attributes, context=context)
pydantic_core._pydantic_core.ValidationError: 3 validation errors for GroupAtMessageCreateEvent
attachments.0.height
  Input should be a valid string [type=string_type, input_value=168, input_type=int]
    For further information visit https://errors.pydantic.dev/2.6/v/string_type
attachments.0.width
  Input should be a valid string [type=string_type, input_value=138, input_type=int]
    For further information visit https://errors.pydantic.dev/2.6/v/string_type
attachments.0.size
  Input should be a valid string [type=string_type, input_value=3512, input_type=int]
    For further information visit https://errors.pydantic.dev/2.6/v/string_type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants