Skip to content

obv1在与nonebot的onebot v11适配器进行对接时一直抛出无法解析的异常 #2

Open
@MemoryShadow

Description

@MemoryShadow

我按照对应的信息令StarRail与OPQBot和nonebot使用/onebot/v11/ws这个挂载点对接后, nonebot对传入的信息不断的抛出异常. 我推测可能是由于传入的信息与V11内置的格式不匹配造成的, 希望作者修复这个问题或是提供更多的信息.

附上抛出的异常相关部分:

07-30 15:02:13 [DEBUG] nonebot | OneBot V11 | Event Parser Error
...
lib/python3.11/site-packages/nonebot/adapters/onebot/v11/adapter.py", line 419, in json_to_event
    event = model.parse_obj(json_data)
  File "pydantic/main.py", line 526, in pydantic.main.BaseModel.parse_obj
    return cls(**obj)
  File "pydantic/main.py", line 341, in pydantic.main.BaseModel.__init__
    raise validation_error
pydantic.error_wrappers.ValidationError: 2 validation errors for MessageEvent
sub_type
  field required (type=value_error.missing)
font
  field required (type=value_error.missing)

通过我的观察, 应该是消息事件中的数据缺少了sub_type, original_message, font这几个字段,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions