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

smartqqbot

v0.9.0

Published

对 SmartQQ 协议的封装,方便快速开发 QQ 机器人

Downloads

15

Readme

SmartQQ-bot

对 SmartQQ 协议的封装,方便 QQ 机器人的开发

快速开始

const qq = require('smartqqbot');

let bot = qq.new();
// 登录
bot.login((error) => {
  if (error) console.log(error);
  // 初始化
  bot.initialize();
});

// 打印群消息
bot.on('group_message', (content, from, send) => {
  console.log((send.card || send.markname || send.nick) + ': ' + content + ' from: ' + from.name);
});

// 打印联系人消息并回复同样的内容
bot.on('message', (content, from, to) => {
  console.log((from.markname || from.nick) + ': ' + content);
  bot.sendBuddyMessage(from.uin, content);
});

// 打印讨论组消息
bot.on('discuss_message', (content, from, send) => {
  console.log((send.markname || send.nick) + ' : ' + content + ' from ' + from.name);
});

API 说明

new()

  • return: <QQ>

返回一个新建的 QQ 实例

QQ 类

'message' 事件

  • content<String> 消息内容
  • from<Object> 消息来源
  • to<Object> 消息发往

收到联系人消息或者在其他客户端发送联系人消息时触发

'group_message' 事件

  • content<String> 消息内容
  • from<Object> 消息来源(群)
  • send<Object> 消息发送人(联系人)

收到群消息或者在其他客户端发送群消息时触发

'discuss_message' 事件

  • content<String> 消息内容
  • from<Object> 消息来源(讨论组)
  • send<Object> 消息发送人(联系人)

收到讨论组消息或者在其他客户端发送讨论组消息时触发

QQ.login([path, callback])

  • path<String> 二维码文件储存位置,默认为 "qrcode.png"
  • callback<Function>
    • error<Error>

登录 QQ,需要手动打开二维码文件扫码

QQ.initialize([callback])

  • callback<Function>
    • error<Error>

初始化 QQ,包括获取 QQ 群列表、联系人列表、讨论组列表和最近联系人列表

QQ.sendBuddyMessage(uid, message[, option])

  • uid<Number> 联系人 uid
  • message<String> 需发送的消息
  • option<Object>
    • color<String> 字体颜色,默认为 "000000"
    • name<String> 字体名,默认为 "宋体"
    • size<String>|<Number> 字体大小,默认为 10
    • style<String> 字体样式,默认为 [0, 0, 0]

向联系人发送消息,其中 uid 非 QQ 号,需要从联系人列表中查询

QQ.sendGroupMessage(gid, message[, option])

  • gid<Number> 群 gid
  • message<String> 需发送的消息
  • option<Object>
    • color<String> 字体颜色,默认为 "000000"
    • name<String> 字体名,默认为 "宋体"
    • size<String>|<Number> 字体大小,默认为 10
    • style<String> 字体样式,默认为 [0, 0, 0]

向群发送消息,其中 gid 非群号,需要从群列表中查询

QQ.sendDiscuMessage(did, message[, option])

  • did<Number> 群 did
  • message<String> 需发送的消息
  • option<Object>
    • color<String> 字体颜色,默认为 "000000"
    • name<String> 字体名,默认为 "宋体"
    • size<String>|<Number> 字体大小,默认为 10
    • style<String> 字体样式,默认为 [0, 0, 0]

向讨论组发送消息,其中 did 非套讨论组号,需要从讨论组列表中查询