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.2.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.2.tar.gz.

File metadata

File hashes

Hashes for python_library_onebot_protocol-0.1.2.tar.gz
Algorithm Hash digest
SHA256 b6678d99a25f0bee94334cee240acc356762f044386bc8af920c1e45e77eeee7
MD5 1d6171c79eddfe7dc62f346eda85eba1
BLAKE2b-256 1bd1a8c76d3568bca26e32b11493db6f1d89a58767652fc60bb540ea079928c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for python_library_onebot_protocol-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2f967f4bf44deeccc66d2b87d0a412f05fd12190e2895b926aa51970990a9d96
MD5 3df8d795fc0fba1ae20dba3c5ed45c51
BLAKE2b-256 330f58cd193daed4ad6e71edb08bb03e7747f23adc37f5d20c76e2229e162252

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