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 🙏

© 2024 – Pkg Stats / Ryan Hefner

qbot-sdk

v1.0.13

Published

基于 [官方 SDK](https://github.com/tencent-connect/bot-node-sdk) ,由于官方缺少很多新的东西,所有扩展增加了群消息接收与发送功能,封装了这个库。

Downloads

1,048

Readme

QQ 机器人 Node SDK: qbot-sdk ✨

基于 官方 SDK ,由于官方缺少很多新的东西,所有扩展增加了群消息接收与发送功能,封装了这个库。

使用方法

安装

npm i qbot-sdk

引用

可参见代码仓库目录example中样例

const {
  createOpenAPI,
  createWebsocket,
  AvailableIntentsEventsEnum,
} = require("qq-bot-sdk"); // commonjs引用方法

import {
  createOpenAPI,
  createWebsocket,
  AvailableIntentsEventsEnum,
} from "qq-bot-sdk"; // es引用方法

const testConfigWs = {
  appID: "APPID",
  token: "TOKEN",
  intents: [AvailableIntentsEventsEnum.GUILD_MESSAGES], // 设置监听类型
};

const client = createOpenAPI(testConfigWs); // 创建client实例(用于发送消息)
const ws = createWebsocket(testConfigWs); // 创建ws实例(用于接收消息)

新增 群&私聊 场景下,事件及方法

群聊场景下请使用 client.groupApi,私聊场景下请使用 client.c2cApi,后方内容基本相同

/** 单聊消息 */
ws.on(AvailableIntentsEventsEnum.C2C_MESSAGES, async (data) => {
  console.log("[C2C_MESSAGES] 事件接收 :", data);
});
/** 单聊操作 */
ws.on(AvailableIntentsEventsEnum.C2C_ACTION, (data) => {
  console.log("[C2C_ACTION] 事件接收 :", data);
});
/** 群聊操作 */
ws.on(AvailableIntentsEventsEnum.GROUP_ACTION, (data) => {
  console.log("[GROUP_ACTION] 事件接收 :", data);
});
/** 群聊消息 */
ws.on(AvailableIntentsEventsEnum.GROUP_MESSAGES, async (data) => {
  console.log("[GROUP_MESSAGES] 事件接收 :", data);
});

其他方法和事件请查看官方文档,与官方文档保持一致。

注意

本 SDK 带来的所有影响与官方无关。