Skip to main content

Oopzbot SDK

面向 Oopz 语音平台的现代化异步 Python SDK。

License Python PyPI - Version Async Typing OneBot Docs

异步优先 · 事件驱动 · 类型友好 · 消息 / 媒体 / 语音

快速开始 · 功能特性 · 文档 · 示例 · 贡献


这是什么?

oopz-sdk 是一个面向 Oopz 平台 的异步 Python SDK,用于快速构建机器人、监听事件、收发消息、上传媒体并调用平台服务。

✨ 功能特性

  • Bot 入口简单:通过 OopzBot 完成连接、事件监听、消息回复和 Service 调用。
  • 异步优先:基于 asyncio,适合长期运行的机器人和服务端应用。
  • 类型友好:核心模型基于 Pydantic v2,便于补全、校验和测试。
  • 事件驱动:支持消息、私信、撤回、编辑、频道变化、语音进出、身份组变化等事件。
  • 消息与媒体:支持文本、图片、私信、引用回复、消息段解析和文件上传。
  • Service 分层:提供消息、媒体、域、频道、用户、管理、语音等能力入口。
  • 生态适配:OneBot v11和v12 适配正在不断完善~

📦 安装

pip install oopz-sdk

从源码安装:

git clone https://github.com/tangqingfeng7/Oopzbot-SDK.git
cd Oopzbot-SDK
pip install -e .

开发环境:

pip install -e ".[dev]"
pytest

需要语音能力时,还需要安装 Playwright Chromium:

python -m playwright install chromium

🚀 快速开始

创建 bot.py:

import asyncio

from oopz_sdk import OopzBot, OopzConfig


bot = OopzBot(OopzConfig.from_env())


@bot.on_ready
async def on_ready(ctx):
    print("[READY] connected")


@bot.on_message
async def on_message(message, ctx):
    if message.text.strip() == "ping":
        await ctx.reply("pong")


asyncio.run(bot.run())

设置环境变量后运行:

export OOPZ_LOGIN_PHONE="..."
export OOPZ_LOGIN_PASSWORD="..."
python bot.py

Windows PowerShell:

$env:OOPZ_LOGIN_PHONE = "你的 OOPZ 登录账号"
$env:OOPZ_LOGIN_PASSWORD = "你的 OOPZ 登录密码"
python bot.py

更多登录方法详见 认证与凭据:

在机器人能收到的频道里发送:

ping

机器人会回复:

pong

更多用法请查看文档。

许可

Oopzbot-SDK 采用 MIT 许可证进行开源

免责声明

本项目由社区开发与维护,旨在为 Oopz 机器人开发、自动化集成和协议适配提供更方便的 Python 接口。使用本项目时请遵守 Oopz 平台相关规则,并妥善保管账号凭证、JWT、私钥等敏感信息。

Metadata

Release files for oopz-sdk 0.16.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oopz-sdk 0.16.0
File Size Uploaded Provenance Actions
oopz_sdk-0.16.0.tar.gz 178.7 kB Without provenance Details for oopz_sdk-0.16.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for oopz-sdk 0.16.0
File Interpreter ABI Platform Actions
oopz_sdk-0.16.0-py3-none-any.whl Python 3 none any Details for oopz_sdk-0.16.0-py3-none-any.whl

Total release size: 344.6 kB

Release files / oopz_sdk-0.16.0.tar.gz

Download URL oopz_sdk-0.16.0.tar.gz
Size 178.7 kB
Tags Source
SHA-256 checksum
How to use checksums
79307af420cfda89e384b46cdae8f270f25cae795ad52228dab3d8b129db9d83
BLAKE2b-256 checksum
How to use checksums
4c0e857cac48b2fa192b8daf21523afccd679ec876d4a99f93e5c3466bc9fed7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release files / oopz_sdk-0.16.0-py3-none-any.whl

Download URL oopz_sdk-0.16.0-py3-none-any.whl
Size 165.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
22e48eaf0b7138c19a8c9d9c38fad42595762e5262f70c98275225bdc11373e4
BLAKE2b-256 checksum
How to use checksums
543236ce0909c7ab5b36f1162b0b64c053e043ad7c2fd944cb0ae3b6190f969b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Security for oopz-sdk 0.16.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page