npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

openclaw-serverchan-bot

v2026.2.6

Published

OpenClaw Server酱³ Bot channel plugin

Readme

openclaw-serverchan-bot

Server酱³ Bot channel plugin for OpenClaw - 支持双向消息通信的 Server酱³ Bot 渠道插件。

功能特点

  • 📤 下行推送:通过 OpenClaw 向 Server酱³ App 发送消息
  • 📥 上行回复:接收用户通过 Server酱³ App 发送的消息,并由 AI 自动回复
  • 🔄 双向通信:完整的 Telegram Bot API 兼容接口

安装

从 NPM 安装(推荐)

openclaw plugins install openclaw-serverchan-bot

从本地安装

openclaw plugins install ./extensions/serverchan-bot

获取 Bot Token

  1. 访问 Server酱³ 控制台 登录账号
  2. 创建一个新的 Bot 或使用已有的 Bot
  3. 复制 Bot Token

配置

在 OpenClaw 配置文件中添加以下内容:

基础配置

{
  channels: {
    "serverchan-bot": {
      enabled: true,
      botToken: "your-bot-token-here",
      chatId: "your-chat-id",  // 消息目标用户 ID
      dmPolicy: "open",
    },
  },
}

如何获取 chat_id? 在 Server酱³ App 中向 Bot 发送任意消息,查看 OpenClaw 日志即可看到你的 chat_id。

完整配置选项

{
  channels: {
    "serverchan-bot": {
      // 必需:启用渠道
      enabled: true,
      
      // 必需:Bot Token(从 Server酱³ 控制台获取)
      botToken: "your-bot-token-here",
      
      // 必需:目标用户 chat_id
      // - 用于主动推送消息
      // - 双向对话时会自动从入站消息获取,可作为默认值
      chatId: "your-chat-id",
      
      // 可选:DM 策略
      // - "open": 允许所有用户发送消息(推荐测试时使用)
      // - "pairing": 需要配对验证(默认,更安全)
      // - "allowlist": 只允许特定用户
      // - "disabled": 禁用私聊
      dmPolicy: "open",
      
      // 可选:允许列表(当 dmPolicy 为 "allowlist" 时生效)
      allowFrom: ["user-id-1", "user-id-2"],
      
      // 可选:轮询配置
      pollingEnabled: true,      // 是否启用轮询(默认 true)
      pollingIntervalMs: 3000,   // 轮询间隔,毫秒(默认 3000)
      
      // 可选:Webhook 配置(高级)
      webhookUrl: "https://your-domain.com/webhook",
      webhookSecret: "your-webhook-secret",
      webhookPath: "/serverchan-bot/webhook",
    },
  },
}

使用场景说明

| 场景 | chat_id 来源 | 说明 | |------|-------------|------| | 双向对话 | 自动获取 | 用户先发消息,AI 回复时自动使用入站消息的 chat_id | | 主动推送 | 配置文件 | OpenClaw 主动推送通知,必须配置 chat_id |

使用环境变量

也可以通过环境变量配置 Bot Token:

export SERVERCHAN_BOT_TOKEN="your-bot-token-here"

使用方法

1. 启动 Gateway

配置完成后,重启 OpenClaw Gateway:

openclaw gateway restart

2. 验证连接

查看渠道状态:

openclaw channels status

或在 OpenClaw Web UI 的 Channels 页面查看 "Server酱³ Bot" 状态。

3. 开始对话

  • 打开 Server酱³ App
  • 向你的 Bot 发送消息
  • 等待 AI 回复

多账号配置

如果需要配置多个 Bot 账号:

{
  channels: {
    "serverchan-bot": {
      enabled: true,
      dmPolicy: "open",
      accounts: {
        default: {
          botToken: "token-for-default-account",
        },
        work: {
          botToken: "token-for-work-account",
          chatId: "work-chat-id",
        },
      },
    },
  },
}

常见问题

Q: 消息发送失败?

  1. 检查 Bot Token 是否正确
  2. 确认 Gateway 已启动
  3. 查看日志:openclaw gateway logs

Q: 没有收到 AI 回复?

  1. 确认 dmPolicy 设置为 "open" 或用户在允许列表中
  2. 检查 AI 模型配置是否正确
  3. 查看详细日志

Q: 如何查看实时日志?

openclaw gateway logs --follow

API 兼容性

本插件使用 Server酱³ Bot API,与 Telegram Bot API 类似,支持以下 API:

  • getMe - 获取 Bot 信息
  • sendMessage - 发送消息( 文本,支持 Markdown 格式)
  • getUpdates - 获取更新(轮询模式)

相关链接

许可证

MIT