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 🙏

© 2025 – Pkg Stats / Ryan Hefner

koishi-plugin-onebot-button

v1.0.0

Published

个人自用测试插件(真的个人自用吗?)

Readme

koishi-plugin-onebot-button

npm

OneBot 协议扩展插件,提供交互式按钮、Protobuf 数据包操作和长消息功能。

关于与鸣谢

本插件代码来自于Packet-pluginastrbot_plugin_buttons,本人仅作适配修改。

  • 功能仅限测试,请勿滥用,请于下载之后 24h 之内删除。
  • 本插件仅供学习交流,使用此插件产生的一切后果由使用者承担。
  • 支持版本:9.1.55~最新版(已知 9.1.75 不支持)

发包一时爽,封号火葬场!

🌟 功能特性

  • 📱 交互式按钮 - 发送可点击的按钮消息,支持回调和链接
  • 📦 Protobuf 数据包 - 发送和接收原始 protobuf 数据包
  • 📄 长消息支持 - 发送和接收长消息内容
  • 🔧 调试工具 - 获取消息的 protobuf 数据用于调试

📖 命令使用

# 单个回调按钮
packet button 确认-confirm
# 单个链接按钮
packet button 百度~https://baidu.com
# 多个按钮(同行)
packet button 确认-confirm, 取消-cancel
# 多行按钮布局
packet button 菜单-menu, 帮助-help|设置-settings, 退出-exit
# 设置按钮样式
packet button 确认-confirm -s 1
# 发送 PB 元素
packet pb [{"53": {"1": 46, "2": {"1": {"1": [], "2": "test"}}}}]
# 发送原始数据包
packet pb.raw MessageSvc.PbSendMsg {"1": {"1": {"1": 12345}}}
# 获取消息的 PB 数据
packet pb.get 1234567890
# 使用序列号获取
packet pb.get 123 -s
# 发送长消息
packet long {"text": "这是一条长消息内容"}
# 生成 ResID
packet long.id {"text": "长消息内容"}
# 获取长消息内容
packet long.get ABC123DEF456

按钮消息 (button)

发送交互式按钮消息,支持多种按钮类型。

基本语法

packet button <内容> [-s <样式>]

参数说明

  • 内容: 按钮配置字符串
  • -s, --style: 按钮深浅,0-1(默认为 0)

按钮格式

  1. 回调按钮: 显示文本-回调命令
  2. 链接按钮: 显示文本~链接地址
  3. 多行按钮: 使用 | 分隔不同行
  4. 同行按钮: 使用 , 分隔同行的多个按钮

Protobuf 操作 (pb)

发送 PB 元素

packet pb <elements>

发送 protobuf 元素数据,需要提供 JSON 数组格式的数据。

发送原始 PB 数据

packet pb.raw <cmd> <content>
  • cmd: protobuf 命令名称
  • content: JSON 格式的数据内容

获取 PB 数据

packet pb.get [messageId] [-s]
  • messageId: 消息 ID(可选,不提供时使用引用消息)
  • -s, --seq: 使用序列号而非消息 ID

长消息 (long)

发送长消息

packet long <content>

发送长消息内容,需要提供 JSON 格式的数据。

生成长消息 ResID

packet long.id <content>

生成长消息的资源 ID,返回可用于构建长消息元素的 protobuf 数据。

获取长消息内容

packet long.get <resid>

通过 ResID 获取长消息的完整 protobuf 数据。

🔧 技术细节

Protobuf 编码

插件内置了完整的 Protobuf 编码解码器,支持:

  • 可变长度整数编码 (varint)
  • 长度分隔字段编码
  • 嵌套对象编码
  • 字节数据和字符串编码

数据处理

  • 自动处理十六进制字符串转换
  • 支持 hex-> 前缀的十六进制数据
  • BigInt 数据自动转换为安全整数或字符串
  • Buffer 数据自动转换为十六进制表示