云湖平台事件转换模块 (YunhuAdapter4OneBot12)
功能概述
本模块用于将云湖(即时通讯平台)的事件数据转换为标准的OneBot12格式。支持消息、通知等多种事件类型
安装方法
pip install yunhu2onebot12
使用方法
基本使用
from yunhu2onebot12 import Converter
# 创建转换器实例
converter = Converter()
# 云湖平台原始事件数据
yunhu_event = {
"version": "1.0",
"header": {
"eventId": "c192ccc83d5147f2859ca77bcfafc9f9",
"eventType": "message.receive.normal",
"eventTime": 1748613099002
},
"event": {
# ... 事件数据 ...
}
}
# 转换为OneBot12格式
onebot_event = converter.convert(yunhu_event)
支持的事件类型
| 云湖事件类型 |
|---|
| message.receive.normal |
| message.receive.instruction |
| bot.followed |
| bot.unfollowed |
| group.join |
| group.leave |
| button.report.inline |
| bot.shortcut.menu |
消息类型支持
支持以下内容类型的消息转换:
- 文本(text)
- 图片(image)
- 视频(video)
- 文件(file)
- 表单指令(form)
特殊字段处理
部分云湖特有字段会在转换后的OneBot事件中以yunhu_前缀的非标准字段形式保留:
yunhu_form: 表单类型指令数据yunhu_button: 按钮相关数据yunhu_menu: 快捷菜单数据
错误处理
- 如果传入不支持的事件类型,方法会返回
None - 当事件数据格式错误时会抛出
ValueError
注意事项
- 使用 Python 3.7 及更高版本
- 本模块仅处理事件格式转换,不包含网络通信功能
- 云湖特有字段在OneBot12标准中可能不被其他组件识别
- 表单消息/按钮/快捷菜单 事件是云湖平台特有功能,转换后会添加
yunhu_前缀
Metadata
Release files for yunhu2onebot12 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| yunhu2onebot12-1.2.0.tar.gz | 5.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| yunhu2onebot12-1.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.8 kB
Release files / yunhu2onebot12-1.2.0.tar.gz
| Download URL | yunhu2onebot12-1.2.0.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c6ef6cd78e0d1a2269d5c073a2102c6e9bb68014c712df4054577a05a42dc54c
|
|
BLAKE2b-256 checksum How to use checksums |
dd038a9ab4eb6fd1527a5376cf30c6f1fed4d7e2e863937d4ce12bfb5f9c732e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 27, 2026.
Transparency logRelease files / yunhu2onebot12-1.2.0-py3-none-any.whl
| Download URL | yunhu2onebot12-1.2.0-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c7ddfeecfabdb955496fa607162de041f0ac36a80000401c48ce8b0da23ab2a7
|
|
BLAKE2b-256 checksum How to use checksums |
bb8ae680941728217e7a7ffce40fe6629db520f4cc67d9e3a89956b001094342
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 27, 2026.
Transparency log