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

@ion-bot/sender-cqhttp

v0.1.1

Published

Classes for cqhttp events and messages.

Downloads

20

Readme

@ion-bot/sender-cqhttp

@ion-bot/sender-* logo

GitHub Org GitHub Build status npm (scoped) GitHub code size in bytes

@ion-bot/sender-cqhttp 是一系列用以存储 coolq-http-api 上报对象并提供方法来回应它们的类。

Introduction

@ion-bot/sender-cqhttp 是一个类库,因此你可以这样将其包含进你的项目中:

import * as Senders from '@ion-bot/sender-cqhttp'
const sendAddress = 'http://localhost:5700' // cqhttp api 所在 URL
Senders.IonSenderCqhttp.setSendAddress(sendAddress) // 设置上报 URL
// 四类 sender,params 在下文指代原始上报对象
const PlainSender = new Senders.IonSenderCqhttp(params)
const MessageSender = new Senders.IonSenderCqhttpMessage(params) // 继承了 IonSenderCqhttp
const RequestSender = new Senders.IonSenderCqhttpRequest(params) // 继承了 IonSenderCqhttp
const NoticeSender = new Senders.IonSenderCqhttpNotice(params) // 继承了 IonSenderCqhttp

Definition

这里列出了四个 sender 类中所有可用方法、属性,附带说明。

所有返回 Promise 的函数,除非特别说明,返回的将是 AxiosPromise,即 http 请求。

IonSenderCqhttp

class IonSenderCqhttp {

    startTime: Date // 创建对象的时间

    // 3个分别为是否群组/讨论组/私聊
    isGroup: boolean
    isDiscuss: boolean
    isPrivate: boolean

    target: number // 发信群/讨论组/用户
    targetUser: number // 发信用户

    region: string // 类别(message/request/notice)
    type: string // 细分类别

    // 原始上报对象
    // 建议只读
    param: object

    // 获取 IonSenderCqhttp 这一 class
    // 以便直接调用 static 函数
    static()

    async info(): object // 获取发信者信息
    async memberList(): object[] // (当群组时)获取成员列表
    leave(): Promise // (当群组时)退群/退讨论组
    kick(rejectAddRequest: boolean = false): Promise // (当群组时)(当有权限时)踢出发送者
    ban(duration: number): Promise // (当群组时)(当有权限时)禁言发送者
    unban(): Promise // (当群组时)(当有权限时)解除禁言发送者
    wholeBan(): Promise // (当群组时)(当有权限时)全员禁言
    wholeUnban(): Promise // (当群组时)(当有权限时)解除全员禁言
    rename(card: string): Promise // (当群组时)(当有权限时)更改发送者名片
    admin(): Promise // (当群组时)(当有权限时)将发送者设为管理员
    unadmin(): Promise // (当群组时)(当有权限时)将发送者解除管理员

    static private(user_id: number, message: string): Promise // 发送私聊消息
    static group(group_id: number, message: string): Promise // 发送群消息
    static discuss(discuss_id: number, message: string): Promise // 发送讨论组消息
    static async groupList(): object[] // 获取群列表
    static async memberList(group_id: number): object[] // 获取群成员列表
    static async userInfo(user_id: number, group_id: number): object // 获取用户信息
    static async selfInfo(): object // 获取登录号信息
    static kick(group_id: number, user_id: number, reject_add_request: boolean = false): Promise // 踢人
    static ban(group_id: number, user_id: number, duration: number): Promise // 禁言
    static unban(group_id: number, user_id: number): Promise // 解除禁言
    static wholeBan(group_id: number): Promise // 全员禁言
    static wholeUnban(group_id: number): Promise // 解除全员禁言
    static leave(group_id: number): Promise // 退群
    static leaveDiscuss(discuss_id: number): Promise // 退讨论组
    static rename(group_id: number, user_id: number, card: string): Promise // 改名片
    static admin(group_id: number, user_id: number): Promise // 设管理员
    static unadmin(group_id: number, user_id: number): Promise // 解除管理员
    static request = {
        friend(flag: string, approve: boolean): Promise, // 同意好友请求
        group(flag: string, approve: boolean): Promise, // 同意拉进群请求
    }
    enter(flag: string, approve: boolean): Promise // 同意加群请求

}

IonSenderCqhttpMessage

regionmessage 时应使用此类。

class IonSenderCqhttpMessage extends IonSenderCqhttp {
    content: string // 发来的消息
    send(message: string|{type: string, data: object}[])  // 发送消息给 target
    error(err: Error) // 发送 error stacktrace 给 target
}

IonSenderCqhttpRequest

regionrequest 时应使用此类。

class IonSenderCqhttpRequest extends IonSenderCqhttp {
    flag: string // 请求标识符
    requestType: string // 请求类型
    send(approve: boolean) // 同意或拒绝请求
}

IonSenderCqhttpNotice

regionnotice 时应使用此类。

class IonSenderCqhttpNotice extends IonSenderCqhttp {
    // 因事件而异
    // 当 type === 'group_upload'
    file: object // 文件信息
    // 当 type === 'group_admin'
    noticeType: string // set:上管理,unset:下管理
    // 当 type === 'group_decrease'
    noticeType: string // leave:主动退,kick:踢,kick_me:自己被踢
    // 当 type === 'group_increase'
    noticeType: string // approve:别人申请,invite:管理邀请
    operatorUser: number // 操作人
    // 当 type === 'friend_add'
    // 无
}