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

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

Open
MemoryShadow opened this issue Jul 30, 2023 · 1 comment · May be fixed by #3
Open

Comments

@MemoryShadow
Copy link

MemoryShadow commented Jul 30, 2023

我按照对应的信息令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这几个字段,

@MemoryShadow
Copy link
Author

MemoryShadow commented Jul 30, 2023

虽然已经修复核心功能, 但是依然会抛出其他的异常, 这个出现异常的情况只在obv1a这个文件中出现, 且不影响核心功能.

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

> File "/home/memoryshadow/Downloads/A/OPQBot/.nonebot-adapter-opqbot-vpy/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: 1 validation error for HeartbeatMetaEvent
status
  field required (type=value_error.missing)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant