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

@onebots/adapter-zulip

v1.0.6

Published

onebots Zulip 适配器

Readme

@onebots/adapter-zulip

onebots Zulip 适配器,基于 Zulip REST API 和 WebSocket API。

特性

  • ✅ 流消息(Stream)和私聊消息(Private)支持
  • ✅ REST API 消息发送
  • ✅ WebSocket 实时事件接收
  • ✅ 消息编辑和删除
  • ✅ 流管理
  • ✅ 用户信息获取
  • ✅ 自动重连支持
  • ✅ 代理配置支持

安装

pnpm add @onebots/adapter-zulip

配置

前置要求

  1. Zulip 服务器

    • 自托管 Zulip 服务器或使用 Zulip Cloud
    • 获取服务器地址,如 https://chat.zulip.org
  2. 获取 API Key

    • 登录 Zulip 服务器
    • 访问 Settings → Your bots → Add a new bot
    • 创建 Bot 并获取 API Key

配置示例

zulip.my_bot:
  # Zulip 服务器配置
  serverUrl: 'https://chat.zulip.org'
  email: '[email protected]'
  apiKey: 'your_api_key'
  
  # WebSocket 配置(可选)
  websocket:
    enabled: true  # 是否启用 WebSocket,默认 true
    reconnectInterval: 3000  # 重连间隔(毫秒),默认 3000
    maxReconnectAttempts: 10  # 最大重连次数,默认 10
  
  # 代理配置(可选)
  proxy:
    url: 'http://127.0.0.1:7890'
  
  # 协议配置
  onebot.v11:
    access_token: 'your_token'

使用示例

发送流消息

// 发送到流 "general" 的话题 "test"
await bot.sendMessage('general/test', {
  scene_id: bot.createId('general/test'),
  scene_type: 'group',
  message: [
    { type: 'text', data: { text: 'Hello from Zulip!' } }
  ]
});

发送私聊消息

// 发送给用户
await bot.sendMessage('[email protected]', {
  scene_id: bot.createId('[email protected]'),
  scene_type: 'private',
  message: [
    { type: 'text', data: { text: 'Hello!' } }
  ]
});

接收消息

适配器会自动接收 WebSocket 事件并转换为消息事件:

bot.on('message', (event) => {
  if (event.platform === 'zulip') {
    console.log('收到 Zulip 消息:', event.sender.name, event.message);
  }
});

消息类型支持

| 消息类型 | 支持 | 说明 | |---------|------|------| | 文本 | ✅ | 支持 Markdown 格式 | | 图片 | ✅ | 通过 Markdown 图片语法 | | 文件 | ✅ | 通过 Markdown 链接语法 |

注意事项

  1. 流消息格式scene_id 格式为 stream_namestream_name/topic
  2. 私聊消息格式scene_id 格式为邮箱地址或逗号分隔的邮箱列表
  3. Markdown 支持:Zulip 支持 Markdown 格式,可以在消息中使用
  4. WebSocket 重连:自动重连机制,可配置重连间隔和最大次数

相关链接