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

koishi-plugin-rbind-bot

v1.0.0

Published

RBind Bot - 账号绑定管理机器人,支持Minecraft账号和B站账号绑定与管理

Readme

RBind Bot

账号绑定管理机器人 - Koishi 插件

一个功能完善的 Koishi 插件,支持 Minecraft 账号和 B站账号的绑定与管理。

✨ 特性

  • 🎮 Minecraft 账号绑定 - 支持用户名和 UUID 管理
  • 📺 B站账号绑定 - 自动获取粉丝牌、舰长等级等信息
  • 🔄 交互式绑定流程 - 友好的对话式绑定体验
  • 白名单管理 - 通过 RCON 远程管理服务器白名单
  • 🏷️ 标签系统 - 灵活的用户分组管理
  • 👥 群昵称自动设置 - 自动规范群昵称格式
  • 🔒 权限管理 - 完善的管理员权限体系
  • 📊 数据统计 - 绑定信息统计与查询

📦 安装

npm install koishi-plugin-rbind-bot
# 或
yarn add koishi-plugin-rbind-bot

🚀 快速开始

1. 安装插件

在 Koishi 控制台的插件市场搜索并安装 rbind-bot

2. 基础配置

plugins:
  rbind-bot:
    # 主管理员 QQ 号
    masterId: "123456789"
    
    # 绑定冷却时间(天)
    cooldownDays: 15
    
    # 调试模式
    debugMode: false
    
    # 显示头像
    showAvatar: true
    showMcSkin: false
    
    # 自动群昵称设置目标群
    autoNicknameGroupId: "987654321"
    
    # B站 Cookie(可选,用于获取粉丝牌信息)
    biliCookie: "SESSDATA=your_sessdata_here"
    
    # 服务器配置
    servers:
      - id: "survival"
        name: "生存服"
        enabled: true
        rconAddress: "127.0.0.1:25575"
        rconPassword: "your_rcon_password"
        displayAddress: "mc.example.com"
        description: "主生存服务器"
        allowSelfApply: true
        idType: "username"

3. 开始使用

# 用户命令
绑定              # 启动交互式绑定流程
mcid bind Steve   # 绑定 MC 账号
buid bind 123456  # 绑定 B站账号
mcid query        # 查询自己的绑定信息

# 管理员命令
mcid admin @用户        # 设置管理员
mcid whitelist servers  # 查看服务器列表

📚 命令列表

普通用户命令

MC 账号相关

  • mcid bind <用户名> - 绑定 MC 账号
  • mcid query - 查询自己的绑定信息
  • mcid unbind - 解绑 MC 账号
  • mcid whitelist servers - 列出所有服务器
  • mcid whitelist add <服务器> - 申请白名单(需服务器允许)

B站账号相关

  • buid bind <UID> - 绑定 B站账号
    • 支持格式:纯数字、UID:123456https://space.bilibili.com/123456
  • buid query - 查询自己的 B站绑定信息

交互式绑定

  • 绑定 - 启动交互式绑定流程(更友好的引导式体验)

管理员命令

账号管理

  • mcid bind <用户名> <目标> - 为他人绑定 MC 账号
  • mcid query <目标> - 查询他人绑定信息
  • mcid unbind <目标> - 为他人解绑
  • buid bind <UID> <目标> - 为他人绑定 B站账号
  • buid finduser <UID> - 查找绑定该 UID 的用户

白名单管理

  • mcid whitelist add <服务器> <目标> - 为用户添加白名单
  • mcid whitelist remove <服务器> <目标> - 移除用户白名单

权限管理(仅主人)

  • mcid admin <目标> - 设置管理员
  • mcid stats - 查看统计信息

⚙️ 配置说明

基础配置

| 配置项 | 类型 | 默认值 | 说明 | |--------|------|--------|------| | cooldownDays | number | 15 | MC 绑定冷却天数,B站为 3 倍 | | masterId | string | '' | 主管理员 QQ 号 | | debugMode | boolean | false | 调试模式 | | showAvatar | boolean | false | 是否显示头像 | | showMcSkin | boolean | false | 是否显示 MC 皮肤渲染 | | autoNicknameGroupId | string | '' | 自动设置群昵称的目标群 ID | | biliCookie | string | '' | B站 Cookie(SESSDATA) |

服务器配置

| 配置项 | 类型 | 必填 | 说明 | |--------|------|------|------| | id | string | ✅ | 服务器唯一 ID | | name | string | ✅ | 服务器名称 | | rconAddress | string | ✅ | RCON 地址(host:port) | | rconPassword | string | ❌ | RCON 密码 | | enabled | boolean | ❌ | 是否启用(默认 true) | | displayAddress | string | ❌ | 展示给用户的地址 | | description | string | ❌ | 服务器说明 | | idType | string | ❌ | ID 类型(username/uuid) | | allowSelfApply | boolean | ❌ | 允许用户自助申请 | | addCommand | string | ❌ | 添加白名单命令模板 | | removeCommand | string | ❌ | 移除白名单命令模板 |

🔧 进阶功能

B站 API 说明

本插件完全基于 B站官方 API,无需依赖第三方服务:

  1. 用户信息 API:获取基本信息(用户名、UID 等)
  2. 粉丝牌 API:获取用户的所有粉丝牌信息(需要 Cookie)

获取 B站 Cookie

  1. 打开浏览器,登录 B站
  2. 按 F12 打开开发者工具
  3. 切换到 Network(网络)标签
  4. 刷新页面,找到任意请求
  5. 在请求头中找到 Cookie
  6. 复制 SESSDATA= 后面的值(或整个 Cookie)
  7. 填入配置中的 biliCookie 字段

交互式绑定流程

用户发送 绑定 命令后,机器人会引导完成以下步骤:

1. 发送 B站 UID(或跳过)
   ↓
2. 发送 MC 用户名(或跳过)
   ↓
3. 自动设置群昵称
   ↓
4. 完成绑定

群昵称格式

自动设置的群昵称格式:B站名称(ID:MC用户名)

示例:

  • 张三(ID:Steve) - 已绑定 MC
  • 李四(ID:未绑定) - 仅绑定 B站

🛠️ 开发

项目结构

rbind-bot/
├── src/
│   ├── handlers/          # 命令处理器
│   │   ├── mcid.handler.ts
│   │   ├── buid.handler.ts
│   │   ├── whitelist.handler.ts
│   │   └── binding.handler.ts
│   ├── services/          # 服务层
│   │   ├── bilibili-api.service.ts
│   │   ├── mojang-api.service.ts
│   │   ├── database.service.ts
│   │   ├── nickname.service.ts
│   │   └── rcon.service.ts
│   ├── types/             # 类型定义
│   ├── utils/             # 工具函数
│   └── index.ts           # 入口文件
├── package.json
├── tsconfig.json
└── README.md

本地开发

# 克隆项目
git clone https://github.com/yourusername/rbind-bot.git
cd rbind-bot

# 安装依赖
npm install

# 编译
npm run build

# 监听模式
npm run dev

# 代码检查
npm run lint

📝 注意事项

  1. RCON 配置:确保 Minecraft 服务器已启用 RCON 并正确配置端口和密码
  2. 权限管理:主人可以设置管理员,管理员无法管理其他管理员
  3. 冷却时间
    • MC 绑定:默认 15 天
    • B站绑定:默认 45 天(3 倍)
    • 管理员操作无冷却限制
  4. B站 Cookie
    • 非必需,但没有 Cookie 将无法获取粉丝牌信息
    • 定期更新以保持有效性

🤝 贡献

欢迎提交 Issue 和 Pull Request!

📄 许可证

MIT License

🙏 致谢

📞 支持

如遇问题,请提交 Issue


Made with ❤️ for Minecraft & Bilibili Community