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.0.tar.gz (2.5 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.0.tar.gz.

File metadata

File hashes

Hashes for python_library_onebot_protocol-0.1.0.tar.gz
Algorithm Hash digest
SHA256 faf2211d24d7518b60e3d3e4617585a7cfb48c7fb95359eaa104bcc0182d5d0f
MD5 e7ae39d713357aae5071ac1a0210b0f4
BLAKE2b-256 caa3398cb28e1cdfb1f08a7201fa858be61632b9c765c6fc71214a8b2d9b6916

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for python_library_onebot_protocol-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a334c12deb9438111c65c2bbd4c051a3d034b9fe9e148c1d67777378def5516e
MD5 abc1418cc2072dc879022629b7768ec3
BLAKE2b-256 860c6c8ab202f0822ccbaa39814c2ece9b231f824a7391496c74cc6ca70184c7

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