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

xinc

v0.2.0

Published

基于napcat,node-napcat-ts的bot框架

Downloads

15

Readme

Xinc Bot - 基于 NapCat 的轻量级 QQ 机器人框架

Xinc

Xinc 是一个基于 NapCat 和 node-napcat-ts 的轻量级 QQ 机器人框架,专注于易用性和可扩展性。通过简单的插件系统,你可以快速构建自己的 QQ 机器人功能。

✨ 功能特点

  • 🚀 开箱即用:简单的命令行工具,一键初始化和启动
  • 🔌 插件系统:强大且灵活的插件机制,轻松扩展功能
  • 🛠️ 丰富的 API:为插件开发提供完整的类型定义和友好的接口
  • 📱 多平台支持:支持 Windows、Linux 和 macOS
  • 🔄 热重载:支持插件热重载,无需重启框架
  • 📊 状态监控:内置状态查看和管理命令
  • 🔒 权限系统:完善的权限控制机制

📦 安装

前提条件

  • Node.js 16.x 或更高版本
  • NapCat 服务端

安装步骤

  1. 创建新项目文件夹并初始化
mkdir my-xinc-bot
cd my-xinc-bot
npm install xinc
npx xinc init
  1. 启动框架
# 直接启动
npx xinc start
# 或者使用 PM2 在后台运行
npx xinc start --pm2

🚀 快速开始

初始化项目后,框架会自动创建一个示例插件。 你可以通过以下命令创建自己的插件:

npx xinc new 插件名称

启动框架后,你可以在 QQ 中发送命令与机器人交互:

  • #帮助 - 显示帮助信息
  • #状态 - 查看框架状态
  • #插件 列表 - 查看插件列表

🔌 插件开发

Xinc 提供了简单直观的插件 API,以下是一个基本插件示例:

import { definePlugin, Structs } from 'xinc'

export default definePlugin({ 
    name: '你好世界', 
    version: '1.0.0', 
    desc: '一个简单的示例插件', 
    setup(ctx) { 
        // 处理消息 
        ctx.handle('message', async e => { 
            if (e.raw_message === '你好') { 
                e.reply('世界,你好!') 
            } 
        }) 
            // 记录插件加载信息 
        ctx.logger.info('插件已加载') 
    }
})

插件上下文

API插件上下文 ctx 提供了丰富的 API:

  • 消息处理:handle, reply, sendPrivateMsg, sendGroupMsg
  • 信息获取:getText, getImageURL, getAtUserID, getGroupList
  • 权限控制:isRoot, isAdmin, isGroupAdmin
  • 群管理:setGroupBan, setGroupKick, setGroupCard

📋 命令列表

基础命令

  • #状态 - 查看框架状态
  • #帮助 - 显示帮助信息
  • #退出 - 关闭框架(仅限主人)

插件管理

  • #插件 列表 - 查看插件列表
  • #插件 启用 <插件名> - 启用指定插件
  • #插件 禁用 <插件名> - 禁用指定插件
  • #插件 重载 <插件名> - 重载指定插件

设置命令(仅限主人)

  • #设置 加管理 - 添加框架管理员
  • #设置 删管理 - 删除框架管理员
  • #设置 加主人 - 添加框架主人
  • #设置 删主人 - 删除框架主人
  • #设置 前缀 <前缀> - 修改命令前缀
  • #设置 日志 <级别> - 修改日志级别

📄 配置文件配置文件

xinc.config.toml 包含以下内容:

host = "127.0.0.1"
port = 5700
prefix = "#"
root = [12345678]
admins = []
plugins = ["你好世界"]
logger = "info"

🤝 贡献指南

欢迎贡献代码、提交 issue 或改进文档。 请遵循以下步骤:

  1. Fork 项目
  2. 创建功能分支 (git checkout -b feature/amazing-feature)
  3. 提交更改 (git commit -m 'Add some amazing feature')
  4. 推送到分支 (git push origin feature/amazing-feature)
  5. 创建 Pull Request

📃 许可证本项目采用 GPL-3.0 许可证。

详情请参阅 LICENSE 文件。

致谢

API 实现---Made with ❤️ by 勿忘初心