Skip to main content
ErisPulse IdeauraAdapter

ErisPulse IdeauraAdapter

花枫咖啡馆(Allons / Ideaura)协议适配器 —— 基于 ErisPulse。

基于 ErisPulse 架构的花枫咖啡馆(Allons / Ideaura)协议适配器,整合所有平台功能模块,提供统一的事件处理和消息操作接口,支持 Token 登录与邮箱密码登录两种方式。

PyPI Python License Stars Downloads ErisPulse


简介

IdeauraAdapter 是基于 ErisPulse 架构的花枫咖啡馆(RockyChat)协议适配器,整合了所有平台功能模块,提供统一的事件处理和消息操作接口。

使用示例

OneBot12标准事件类型

Ideaura适配器完全兼容 OneBot12 标准事件格式,并提供了一些扩展字段:

事件类型 detail_type 说明
消息事件 message 标准消息事件
好友增加 notice.friend_increase 好友请求被接受
好友减少 notice.friend_decrease 好友关系被解除
消息编辑 notice.ideaura_message_edit 消息被编辑
消息撤回 notice.ideaura_message_recall 消息被撤回
消息转发 notice.ideaura_message_forward 消息被转发
消息已读 notice.ideaura_message_read 消息被标记已读
好友被拒 notice.ideaura_friend_rejected 好友请求被拒绝
好友上线 notice.ideaura_friend_online 好友上线
好友下线 notice.ideaura_friend_offline 好友下线
用户状态变更 notice.ideaura_user_status_change 用户状态变化
好友请求 request.friend 收到好友请求

消息发送示例

from ErisPulse.Core import adapter
ideaura = adapter.get("ideaura")

# 发送文本消息
await ideaura.Send.To("user", "user_id").Text("Hello World!")

# 发送带@的消息
await ideaura.Send.To("group", "chatroom").At("456").Text("@李四 你好")

# 触发 Bot 指令
await ideaura.Send.To("group", "chatroom").Command("550e8400-e29b-41d4-a716-446655440000").Text("/weather 北京")

# @多人
await ideaura.Send.To("group", "chatroom").At("456").At("789").Text("@多人")

# @全体
await ideaura.Send.To("group", "chatroom").AtAll().Text("通知所有人")

# 发送回复消息
await ideaura.Send.To("group", "chatroom").Reply("1001").Text("回复内容")

# 发送图片(从本地文件)
with open("photo.jpg", "rb") as f:
    image_data = f.read()
await ideaura.Send.To("group", "chatroom").Image(image_data)

# 发送图片(从URL)
await ideaura.Send.To("group", "chatroom").Image("https://example.com/photo.jpg")

# 发送视频
await ideaura.Send.To("group", "chatroom").Video("https://example.com/video.mp4")

# 发送文件(带文件名)
with open("doc.pdf", "rb") as f:
    file_data = f.read()
await ideaura.Send.To("group", "chatroom").File(file_data, "文档.pdf")

# 发送 Markdown 格式消息
await ideaura.Send.To("group", "chatroom").Markdown("# 标题\n- 列表项")

# 发送 HTML 格式消息
await ideaura.Send.To("group", "chatroom").Html("<b>加粗</b>消息")

# 编辑消息
await ideaura.Send.To("group", "chatroom").Edit("message_id", "修改后的内容")

# 撤回消息
await ideaura.Send.To("group", "chatroom").Recall("message_id")

# 使用 Raw_ob12 发送复杂消息
message = [
    {"type": "text", "data": {"text": "第一行"}},
    {"type": "image", "data": {"file": "http://example.com/img.jpg"}},
    {"type": "text", "data": {"text": "第二行"}}
]
await ideaura.Send.To("group", "chatroom").Raw_ob12(message)

# 组合使用
await ideaura.Send.To("group", "chatroom").Reply("1001").At("456").Text("回复并@")

配置说明

首次运行会生成配置。花枫咖啡馆适配器支持多账户配置。

首次运行生成的默认配置

[IdeauraAdapter.accounts.default]
token = ""             # 机器人 API Token (bot-token-...)
enabled = false       # 是否启用(填写完 token 后改为 true)

适配器使用 Bot Token 进行认证。

Bot Token需要前往MSCPO开放平台获取。

多账户配置示例

# 账户1
[IdeauraAdapter.accounts.bot1]
token = "bot-token-xxxxxx1"
enabled = true

# 账户2
[IdeauraAdapter.accounts.bot2]
token = "bot-token-xxxxxx2"
enabled = true

# 可选:自定义服务器地址
[IdeauraAdapter]
base_url = "https://api.mscpo.com/api/rockychat"
ws_url = "wss://api-cofe.allons-y.uk:3009/mqtt"
heartbeat_interval = 30

配置项说明:

  • token:机器人 API Token(以 bot-token- 开头)
  • enabled:是否启用该账户(可选,默认为 true)

全局配置项:

  • base_url:API 服务器地址(可选,默认为花枫咖啡馆官方地址)
  • ws_url:WebSocket 服务器地址(可选,默认为花枫咖啡馆官方地址)
  • heartbeat_interval:心跳间隔秒数(可选,默认30秒)

指定发送账户

可以通过 Using() 方法指定使用哪个账户发送消息:

from ErisPulse.Core import adapter
ideaura = adapter.get("ideaura")

# 使用账户名发送消息
await ideaura.Send.Using("bot1").To("user", "user123").Text("Hello from bot1!")

# 使用 user_id 发送消息(自动匹配对应账户)
await ideaura.Send.Using("456").To("group", "chatroom").Text("Hello from bot2!")

# 不指定时使用第一个启用的账户
await ideaura.Send.To("user", "user123").Text("Hello from default account!")

平台特有功能

请参考 平台特性文档 了解花枫咖啡馆平台的特有功能,包括特有事件类型、扩展字段说明、消息编辑事件、消息转发事件、好友在线状态事件、用户状态变更事件等内容。

事件监听示例

使用 Event 模块(推荐)

from ErisPulse.Core.Event import message, notice

@message.on_message()
async def handle_message(event):
    if event["platform"] == "ideaura":
        detail_type = event.get("detail_type")
        text = event.get_text()
        
        # 获取触发的 Bot 指令 ID(若有)
        cmd_id = event.get_command_id()
        if cmd_id:
            print(f"收到指令: {cmd_id}")

        if detail_type == "group":
            source_type = event.get_source_type()
            if source_type == "topic":
                topic_name = event.get("ideaura_topic_name")
        elif detail_type == "private":
            pass

@notice.on_notice()
async def handle_notice(event):
    if event["platform"] == "ideaura":
        detail_type = event.get("detail_type")
        
        if detail_type == "ideaura_message_edit":
            new_content = event.get("ideaura_new_content", "")
            
        elif detail_type == "ideaura_message_recall":
            message_id = event.get("message_id")
            
        elif detail_type == "ideaura_friend_online":
            friend_name = event.get_user_nickname()

使用 OneBot12 标准事件

from ErisPulse import sdk

@sdk.adapter.on("message")
async def handle_message(event):
    if event["platform"] == "ideaura":
        user_id = event["self"]["user_id"]
        print(f"消息来自账户: {user_id}")

@sdk.adapter.on("notice")
async def handle_notice(event):
    if event["platform"] == "ideaura":
        pass

@sdk.adapter.on("request")
async def handle_request(event):
    if event["platform"] == "ideaura":
        if event.get("detail_type") == "friend":
            user_nickname = event.get("user_nickname")
            message = event.get("ideaura_message", "")

注意事项

  1. 确保在调用 startup() 前完成所有处理器的注册
  2. 适配器使用 WebSocket 长连接接收事件,在连接时自动向 API 请求 internalToken 进行认证,支持自动重连(固定5秒延迟)
  3. 二进制内容(图片/视频等)支持 bytes、URL、本地路径三种输入方式
  4. 文件大小限制为 10MB
  5. 自身发送的消息(isSelf: true)会被自动过滤,不会产生事件
  6. @全体(AtAll())需要管理员权限
  7. 程序退出时请调用 shutdown() 确保资源释放

参考链接

Metadata

Release files for ErisPulse-Ideaura 4.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-Ideaura 4.1.0
File Size Uploaded
erispulse_ideaura-4.1.0.tar.gz 26.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ErisPulse-Ideaura 4.1.0
File Interpreter ABI Platform
erispulse_ideaura-4.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 45.8 kB

Release files / erispulse_ideaura-4.1.0.tar.gz

Download URL erispulse_ideaura-4.1.0.tar.gz
Size 26.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d623f2dc2d48d7a6e9ced93f474226f427950111ad4466cf7fd618f8b624159d
BLAKE2b-256 checksum
How to use checksums
88a24680d91ab0bdb3bed5f8fd25a4dc42f46dc681b157df37131c1a29ac23b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 12, 2026.

Transparency log

Release files / erispulse_ideaura-4.1.0-py3-none-any.whl

Download URL erispulse_ideaura-4.1.0-py3-none-any.whl
Size 19.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ee15c2a11775fbfb3afe97ea865519c8bc9c879aa1ab13209d01b6e653404ac6
BLAKE2b-256 checksum
How to use checksums
a61339b0247748e4c4673b60c3aa220e5b365a2ba55fa26d18f05df9f8c39a3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 12, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

4.1.0 This release

2 release files

4.0.1

2 release files

4.0.0

2 release files

0.1.0

2 release files

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