云湖事件到OneBot12的协议格式转换器
Project description
云湖平台事件转换模块 (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_前缀
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yunhu2onebot12-1.1.2.tar.gz.
File metadata
- Download URL: yunhu2onebot12-1.1.2.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
229e6c1cd82321e756f0fce31d4150c3eb7bddb56f4b2ede582a084f62751a02
|
|
| MD5 |
36a2067c56aeb57715b018b4c7f6196f
|
|
| BLAKE2b-256 |
47c8ee1bd7824183f281454f403f01e9a61b424c15f0ffa9a567a0ad7b9409dc
|
Provenance
The following attestation bundles were made for yunhu2onebot12-1.1.2.tar.gz:
Publisher:
python-publish.yml on wsu2059q/YunhuAdapter4OneBot12
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yunhu2onebot12-1.1.2.tar.gz -
Subject digest:
229e6c1cd82321e756f0fce31d4150c3eb7bddb56f4b2ede582a084f62751a02 - Sigstore transparency entry: 274733178
- Sigstore integration time:
-
Permalink:
wsu2059q/YunhuAdapter4OneBot12@92a629d35bd25b3862a0c89aea11099d953b7350 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/wsu2059q
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@92a629d35bd25b3862a0c89aea11099d953b7350 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file yunhu2onebot12-1.1.2-py3-none-any.whl.
File metadata
- Download URL: yunhu2onebot12-1.1.2-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d9022df2f68c9f9303b26ff4cb124623d4855d141f4ba8d3b6fc57190d8069c
|
|
| MD5 |
c1d7fbfa66c079817bbbaae80a8fde3d
|
|
| BLAKE2b-256 |
9deef66eaa6da549901ff9374457c0601dabbb36088373d5a65097d06e3afd6d
|
Provenance
The following attestation bundles were made for yunhu2onebot12-1.1.2-py3-none-any.whl:
Publisher:
python-publish.yml on wsu2059q/YunhuAdapter4OneBot12
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yunhu2onebot12-1.1.2-py3-none-any.whl -
Subject digest:
4d9022df2f68c9f9303b26ff4cb124623d4855d141f4ba8d3b6fc57190d8069c - Sigstore transparency entry: 274733179
- Sigstore integration time:
-
Permalink:
wsu2059q/YunhuAdapter4OneBot12@92a629d35bd25b3862a0c89aea11099d953b7350 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/wsu2059q
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@92a629d35bd25b3862a0c89aea11099d953b7350 -
Trigger Event:
workflow_dispatch
-
Statement type: