Skip to main content
ErisPulse-OopzAdapter

ErisPulse-OopzAdapter

ErisPulse 的 Oopz 用户账号适配模块

PyPI Python License ErisPulse

基于用户账号接入 Oopz(非官方接口,建议小号)

声明与风险提示(使用前必读)

简介

Oopz 是游戏开黑语音社区平台。本适配器是社区实现的非官方接入方案(与 Oopz 无任何关联),让 ErisPulse 框架能够通过 Oopz 用户账号收发消息、管理域与频道,事件与响应均转换为 ErisPulse 基线协议(OneBot12)标准格式。

原生事件 → OneBot12 映射关系

Oopz WS 事件 原生含义 OneBot12 事件
9 频道消息 message/group(group_id=频道,oopz_area_id/guild_id=域)
7 私聊消息 message/private(user_id=发送者)
8 / 6 频道/私聊消息撤回 notice + sub_type=recall
57 / 56 频道/私聊消息编辑 notice + sub_type=message_edit(oopz_edited_text)
32 表情回应增撤 notice + sub_type=reaction(oopz_emoji/oopz_reaction_type)
2 好友申请 request/friend(request_id=<target>:<friendRequestId> 复合键)
4 好友被删 notice/friend_decrease
12 / 11 频道禁言/禁麦 notice + sub_type=text_ban/voice_ban
20 / 19 语音频道进出 notice + sub_type=voice_enter/voice_leave(oopz_persons)
25 / 18 / 13 频道创建/更新/删除 notice + oopz_channel_*
28 域信息变更 notice/guild + sub_type=area_update
52 身份组变更 notice/guild + sub_type=role_change
26 / 27 用户信息变更 / 登录态 notice/user + oopz_*
其它 未建模事件 unknown + warning(原始数据在 oopz_raw)

所有事件均携带 oopz_raw(完整原始数据)与 oopz_raw_type;消息段支持 text / mention / mention_all / reply / image / audio / file。

消息发送示例

adapter = adapter.get("oopz")

# 频道消息(group 目标 = 频道 ID,域由适配器自动解析)
await adapter.Send.To("group", "01KPxxxx频道ID").Text("Hello Oopz!")

# 私聊消息(user 目标 = 对方 UID)
await adapter.Send.To("user", "6adxxxx对方UID").Text("私信内容")

# @人 / @全体 / 回复
await adapter.Send.To("group", "01KPxxxx").At("6adxxxx").Text(" 叫你呢")
await adapter.Send.To("group", "01KPxxxx").AtAll().Text("全体注意")
await adapter.Send.To("group", "01KPxxxx").Reply("原始messageId").Text("回复内容")

# 图片(支持 URL / 本地路径 / bytes / base64://)
await adapter.Send.To("group", "01KPxxxx").Image("https://example.com/cat.png")

# 公告样式消息
await adapter.Send.To("group", "01KPxxxx").Important().Text("重要公告")

# OneBot12 段直接发送
await adapter.Send.To("group", "01KPxxxx").Raw_ob12([
    {"type": "text", "data": {"text": "看图 "}},
    {"type": "image", "data": {"file": "https://example.com/img.png"}},
])

# 撤回(需要可见目标上下文)
await adapter.Send.To("group", "01KPxxxx").Recall("messageId")

# 多账号
await adapter.Send.Using("小号甲").To("group", "01KPxxxx").Text("来自甲")

语音/视频/文件发送:Oopz 平台仅支持图片上传,其余媒体段按标准以 retcode=10002 降级拒绝。

好友申请处理

@adapter.on_request
async def handle(event):
    # event.request_id 为复合键 "<target>:<friendRequestId>"
    await event.approve()   # 同意
    # await event.reject()  # 拒绝

标准与扩展 API

await adapter.Api.Using("小号甲").get_self_info()
await adapter.Api.Using("小号甲").get_user_info(user_id="6adxxxx")
await adapter.Api.Using("小号甲").get_group_info(group_id="01KPxxxx")
await adapter.Api.call("oopz.mute_member", area_id="域ID", user_id="对方UID", duration=10)
await adapter.Api.call("oopz.get_history_messages", area_id="域ID", channel_id="频道ID", size=50)

完整动作列表见 platform-features.md。

凭据获取指引

账密模式只需手动提取一样东西:客户端签名私钥(private_key)——uid / JWT / 设备 ID 适配器会自动登录换新,不用管。

  1. 浏览器登录 web.oopz.cn(建议小号),F12 → Console 粘贴:
const raw = crypto.subtle.sign.bind(crypto.subtle);
crypto.subtle.sign = async (a, k, d) => {
  if (k.extractable && !window.pk) {
    const b64 = btoa(String.fromCharCode(...new Uint8Array(await crypto.subtle.exportKey("pkcs8", k))));
    window.pk = 'private_key = "-----BEGIN PRIVATE KEY-----\\n' + b64.replace(/(.{64})(?=.)/g, "$1\\n") + '\\n-----END PRIVATE KEY-----"';
    console.log("%c" + window.pk, "color:#2ecc71;font-weight:bold;font-size:15px;line-height:1.9;background:#1e1e1e;padding:12px;border-radius:6px");
    navigator.clipboard?.writeText(window.pk).catch(() => {});
    const link = document.createElement("a");
    link.href = URL.createObjectURL(new Blob([window.pk], { type: "text/plain" }));
    link.download = "oopz_private_key.txt";
    link.click();
    setTimeout(() => URL.revokeObjectURL(link.href), 1000);
    console.log("%c已同步:控制台打印 + 剪贴板 + 下载 oopz_private_key.txt,粘进账户配置段,补上 phone / password 即可", "color:#2ecc71;font-weight:bold;font-size:14px");
  }
  return raw(a, k, d);
};
console.log("%c发一条消息或切一个频道,private_key 会打出 + 复制 + 下载文件(勿刷新页面)", "color:#e67e22;font-weight:bold;font-size:14px");
  1. 发一条消息或切换一个频道——客户端发起签名请求时私钥被捕获,private_key = "..." 整行同步三路交付:控制台打印、剪贴板、下载 oopz_private_key.txt
  2. 粘进 [Oopz_Adapter.accounts.<名字>],补上 phone / password,完成

原理:私钥是客户端做请求签名用的 WebCrypto 密钥,脚本 hook 住 crypto.subtle.sign 将其导出;中途刷新页面会清掉 hook,需重新粘贴。该私钥全客户端通用、非账号专属。

配置说明

[Oopz_Adapter]
gateway_url = "https://gateway.oopz.cn"   # 网关地址(一般无需修改)
heartbeat_interval = 10                    # WS 心跳间隔(秒)
auto_subscribe_areas = true                # 连接后自动订阅已加入的域
subscribe_areas = []                       # 额外订阅的域 ID
ignore_self = true                         # 忽略账号自己发的消息

[Oopz_Adapter.accounts.default]
enabled = true
login_type = "password"        # password=账密自动登录(推荐);token=四件套(仅密码登录被风控时的备用)
phone = "13800000000"
password = "your-password"
private_key = "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----"
# token 备用模式另需(JWT 过期需重新提取):
# person_uid = "你的UID"
# jwt_signature = "你的JWT"
# device_id = "提取到的设备ID"

多账号:复制多个 [Oopz_Adapter.accounts.<名字>] 段即可,事件会通过 self.account_id 标记来源账户。

运行环境

  • Python 3.10+
  • ErisPulse ≥ 2.7.1(软依赖,运行时检测)
  • 依赖:cryptography

许可证

MIT


Metadata

Release files for ErisPulse-OopzAdapter 0.1.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 ErisPulse-OopzAdapter 0.1.0
File Size Uploaded Provenance Actions
erispulse_oopzadapter-0.1.0.tar.gz 48.0 kB With provenance Details for erispulse_oopzadapter-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ErisPulse-OopzAdapter 0.1.0
File Interpreter ABI Platform Actions
erispulse_oopzadapter-0.1.0-py3-none-any.whl Python 3 none any Details for erispulse_oopzadapter-0.1.0-py3-none-any.whl

Total release size: 85.3 kB

Release files / erispulse_oopzadapter-0.1.0.tar.gz

Download URL erispulse_oopzadapter-0.1.0.tar.gz
Size 48.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d630f523bc924fa3c9d7f2d8f8140d0cf3d52fe170b59d219d6ccd23e8818c65
BLAKE2b-256 checksum
How to use checksums
825e61c145162d7a9b78c7adfe666ee7e00c099b8f04839ba88aa475bc65d0c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.

Transparency log

Release files / erispulse_oopzadapter-0.1.0-py3-none-any.whl

Download URL erispulse_oopzadapter-0.1.0-py3-none-any.whl
Size 37.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cc89b4837293d1c4d1e4d5aa5a5cd0457f79bc5187e4151ce5b50c67db00e050
BLAKE2b-256 checksum
How to use checksums
f25335c8e149228301dfa57f77ba7c6d5f21da148e09ef94cc6deeea301d155a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.

Transparency log

Security for ErisPulse-OopzAdapter 0.1.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for erispulse_oopzadapter-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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