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

cyberbot-core

v0.5.0

Published

cyberbot, 基于napcat-ts, nodejs,轻量qq机器人框架。

Readme

CyberBot

CyberBot 是一个基于 node-napcat-ts 开发的高性能 QQ 机器人框架,提供了丰富的插件系统和易用的 API 接口。

  .oooooo.                .o8                          oooooooooo.                .   
 d8P'  `Y8b              "888                          `888'   `Y8b             .o8   
888          oooo    ooo  888oooo.   .ooooo.  oooo d8b  888     888  .ooooo.  .o888oo 
888           `88.  .8'   d88' `88b d88' `88b `888""8P  888oooo888' d88' `88b   888   
888            `88..8'    888   888 888ooo888  888      888    `88b 888   888   888   
`88b    ooo     `888'     888   888 888    .o  888      888    .88P 888   888   888 . 
 `Y8bood8P'      .8'      `Y8bod8P' `Y8bod8P' d888b    o888bood8P'  `Y8bod8P'   "888" 
             .o..P'                                                                   
             `Y8P'                                                                    

特性

  • 🚀 基于 TypeScript,提供完整的类型支持
  • 🔌 强大的插件系统,支持热插拔
  • 🎯 事件驱动架构,高性能且易于扩展
  • 📝 详细的日志系统
  • 🔒 支持主人和管理员权限管理
  • ⏰ 内置 cron 定时任务支持
  • 🛠 丰富的 API 工具集

安装

  1. 确保你的系统已安装 Node.js (推荐 v16 或更高版本)

  2. 下载项目并安装依赖:

npx cyberbot-core

根据交互步骤进行即可

  1. 检查配置文件 config.json
{
  "baseUrl": "ws://localhost:3001", // napcat WebSocket地址
  "accessToken": "123456", // napcat token
  "throwPromise": false, // 是否抛出异常
  "reconnection": { // 重连配置
    "enable": true, // 是否启用重连
    "attempts": 10, // 重连次数
    "delay": 5000, // 重连延迟
    "debug": false // 是否打印重连日志
  },
  "bot": 12345678, // 机器人QQ号
  "master": [ // 主人QQ号
    1000001
  ],
  "admins": [1000001], // 管理员QQ号列表
  "plugins": { // 插件列表
    "system": [ // 系统插件
      "cmds"
    ],
    "user": [ // 用户插件
      "demo"
    ]
  },
  "logger": { // 日志配置
    "level": "info", // 日志级别
    "maxSize": "10m", // 单个日志文件最大大小
    "maxDays": 7 // 单个日志文件保存天数
  }
}

使用方法

启动机器人

npm start

插件仓库 (下载插件)

https://github.com/RicardaY/cyberbot-plugin.git

插件开发

  1. plugins 目录下创建新的插件目录
  2. 创建 index.ts 文件,使用以下模板:
import { definePlugin, CyberPluginContext } from 'cyberbot-core';

export default definePlugin({
    name: '插件名称',
    version: '1.0.0',
    description: '插件描述',
    setup(ctx: CyberPluginContext) {
        // 注册消息处理器
        ctx.handle('message', async (e) => {
            if (e.raw_message === '你好') {
                await e.reply('世界,你好!');
            }
        });
        
        // 注册定时任务
        ctx.cron('0 * * * *', () => {
            console.log('每小时执行一次');
        });
    }
});

可用的上下文 API

  • ctx.sendPrivateMessage(): 发送私聊消息
  • ctx.sendGroupMessage(): 发送群消息
  • ctx.handle(): 注册事件处理器
  • ctx.cron(): 注册定时任务
  • ctx.isMaster(): 检查是否为主人
  • ctx.isAdmin(): 检查是否为管理员
  • 更多 API 请参考源码文档

插件管理

  • 启用插件:ctx.plugin.onPlugin('插件名')
  • 禁用插件:ctx.plugin.offPlugin('插件名')
  • 重载插件:ctx.plugin.reloadPlugin('插件名')
  • 获取插件列表:ctx.plugin.getPlugins()

日志系统

日志文件保存在 log 目录下,按日期自动分割。

贡献

欢迎提交 Issue 和 Pull Request!

许可证

MIT License

致谢

作者

@星火