Skip to main content

OneBot 风格消息载荷与消息段模型

Project description

onebot-protocol

OneBot 通信协议,定义消息收发的公共数据结构。基于OneBot 11标准,使用 Pydantic 提供类型安全的模型定义。

特性

  • 完整的消息段(Message Segment)类型:文本、提及、图片、语音、视频、文件、位置、回复等
  • 图片、语音、音频、视频、文件段共用 FileDatanamecontentmime_typesize
  • 支持 discriminated union,根据 type 字段自动解析消息类型

文件载荷 FileData

字段 说明
name 显示用文件名(可选)
content 内容引用,如 URL、平台资源标识或 Base64 等(可选,编码由实现方约定)
mime_type MIME 类型(可选)
size 字节大小(可选)

image / voice / audio / video / file 各段类型的 data 均为对应子类,字段与 FileData 相同。

支持的消息类型

类型 说明
text 纯文本
mention @某人
mention_all @所有人
image 图片
voice 语音
audio 音频
video 视频
file 文件
location 位置
reply 回复

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

python_library_onebot_protocol-0.1.1.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file python_library_onebot_protocol-0.1.1.tar.gz.

File metadata

File hashes

Hashes for python_library_onebot_protocol-0.1.1.tar.gz
Algorithm Hash digest
SHA256 07ac52281554c03046b21d0bbbf0b8828e52996f8a8d29b9374d6ed2858b8cef
MD5 eec8b6961783e73205dc46d2757d2a96
BLAKE2b-256 feee8fac51ffc14a961f15f5eefca848c1627307ffb071d8162875424b1c79ae

See more details on using hashes here.

File details

Details for the file python_library_onebot_protocol-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for python_library_onebot_protocol-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 aad41604591aeb5da47d9c956736e665028b7f1be54b0258ab262f4fee000a06
MD5 fd486a8f76efb6355eaa49862e7d874f
BLAKE2b-256 f89af9efd8076f838c634d53091c3b012ba08b0552c351c69e0ce4b7169c0d71

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page