Skip to main content

ErisPulse的沙箱适配器,提供网页界面用于调试和模拟消息

Project description

ErisPulse 沙箱适配器 (v4.0.0)

ErisPulse 的沙箱适配器,提供网页界面用于调试和模拟消息, 可以帮助您在不接入实际机器人平台的情况下进行开发和测试。

安装

pip install ErisPulse-SandboxAdapter
# 或者 epsdk install sandbox

配置

首次运行会自动生成默认配置。

# config.toml
[SandboxAdapter]
self_id = "sandbox_bot"        # 沙箱机器人ID(可选,默认为 sandbox_bot)
enable = true                  # 是否启用(可选,默认为true)

消息发送

沙箱适配器支持链式消息发送 DSL,支持以下功能:

基本发送方法

# 发送文本
adapter.Send.To("user", "123").Text("Hello")

# 发送图片
adapter.Send.To("user", "123").Image("image_url")

# 发送表情
adapter.Send.To("group", "456").Face(1)

链式修饰方法

# @用户
adapter.Send.To("group", "456").At("user123").Text("Hello")

# @全体成员
adapter.Send.To("group", "456").AtAll().Text("Everyone")

# 回复消息
adapter.Send.To("group", "456").Reply("msg_id").Text("Reply")

# 链式组合
adapter.Send.To("group", "456").At("user1").At("user2").Reply("msg_id").Text("Hello")

原始消息发送

# 发送 OneBot12 格式消息段
adapter.Send.To("group", "456").Raw_ob12([
    {"type": "text", "data": {"text": "Hello"}},
    {"type": "image", "data": {"file": "url"}}
])

大小写不敏感

方法名支持大小写不敏感调用:

# 以下调用方式等效
adapter.Send.To("user", "123").Text("hi")
adapter.Send.To("user", "123").text("hi")
adapter.Send.To("user", "123").TEXT("hi")

不支持的方法

调用不支持的方法时,会自动发送文本提示:

adapter.Send.To("user", "123").UnsupportedMethod("data")
# 实际发送: "[不支持的发送类型] 方法名: UnsupportedMethod, 参数: [data]"

开发

沙箱适配器可以模拟一个完整的标准适配器,可以辅助开发和调试,使用时请确保你进行了多适配器的适配 在获取到事件event后可以获取platform属性进行平台判断,具体实现请查看ErisPulse的官方文档

使用

  1. 启动适配器后,访问 http://localhost:8000/sandbox/(端口号根据你的配置)
  2. 在网页中添加虚拟好友或群聊
  3. 选择一个聊天,发送消息
  4. 适配器会自动将消息转换为 OneBot12 标准事件并发送给模块

网页界面功能

ErisPulse-SandboxAdapter

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

erispulse_sandboxadapter-4.0.2.tar.gz (37.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

erispulse_sandboxadapter-4.0.2-py3-none-any.whl (34.8 kB view details)

Uploaded Python 3

File details

Details for the file erispulse_sandboxadapter-4.0.2.tar.gz.

File metadata

  • Download URL: erispulse_sandboxadapter-4.0.2.tar.gz
  • Upload date:
  • Size: 37.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for erispulse_sandboxadapter-4.0.2.tar.gz
Algorithm Hash digest
SHA256 7fe424a67a85338317d776de6a01f66b573812d95dbd5ae247c885e1fb10ac99
MD5 6e250252a284f7653460ecca128bf016
BLAKE2b-256 ecb6c49ef5b509037bcf3f4a037f4774aa3e8653a81cd4a82054b6bca6d0ae55

See more details on using hashes here.

Provenance

The following attestation bundles were made for erispulse_sandboxadapter-4.0.2.tar.gz:

Publisher: python-publish.yml on ErisPulse/ErisPulse-SandboxAdapter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file erispulse_sandboxadapter-4.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for erispulse_sandboxadapter-4.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9281ae74900df887477c407d125a95d1d5a851e4fcc433d8f40a72285095cb25
MD5 aafe52cd954d20c41a32feb82d8a6942
BLAKE2b-256 ce1ca43bd41e61a533e54f5dd52deba7e0518d307923b715f5241ad4f05292ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for erispulse_sandboxadapter-4.0.2-py3-none-any.whl:

Publisher: python-publish.yml on ErisPulse/ErisPulse-SandboxAdapter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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