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

go-cqwebsocket

v6.3.2

Published

cq-websocket 停止维护后的替代

Downloads

255

Readme

go-cqwebsocket

介绍

针对 go-cqhttp 开发的 SDK, 跟随官方文档更新

本SDK中所有api基于 go-cqhttp-v1.2.0

在一定程度上兼容 OpenShamrock-v1.0.8

关于此SDK

关于 CQWebsocket 的 API 接口,以 go-cqhttp 帮助中心 APIOpenShamrock 帮助中心 API 为准

同时提供 send(...) 方法以供未知接口的调用

在自己项目中引用

在项目根目录中运行 npm install go-cqwebsocket

API

import {CQWebSocket, CQ} from "go-cqwebsocket"

CQWebSocket

const bot = new CQWebSocket({options})
  • 参数 options

| 可选参数 | 类型 | 默认值 | 描述 | | ------------ | --------------- | ----------------------- | ------------------------------------ | | protocol | ws: , wss: | "ws:" | 协议 | | host | string | "127.0.0.1" | 地址 | | port | number | 6700 | 端口 | | accessToken | string | "" | 校验口令 | | baseUrl | string | "ws://127.0.0.1:6700" | 完整链接, 当配置中有此项时, 优先使用 | | clientConfig | ClientOptions | undefined | ws 配置 |

注1: CQWebSocket 中实现了对应的API, 查找&调用请参考 go-cqhttp 帮助中心 APIOpenShamrock 帮助中心 API

注2: CQWebSocket 中实现了对应的Event, 查找请参考 go-cqhttp 帮助中心 EventOpenShamrock 帮助中心 Event

注册监听请使用 bot.on(...), bot.once(...), bot.off(...), bot.bind(...), bot.unbind(...)

注3: 实例属性 errorEvent 用于替代默认的 error 事件, 仅在事件运行出错时调用

注4: 自动重连 功能请自行实现, 本 SDK 中已将两个连接的事件分开触发


CQ

  • CQ.escape(str) | CQ.unescape(str):转义/反转义方法
  • CQ.text(...) | CQ.at(...)等:便捷构建 CQ码 的方法
  • CQ.custom(...) :自定义 CQ码, 有不被识别的风险
  • CQ.parse(...) :将携带 CQ码 的 字符串 数组 转换为 CQTag数组

Tags

  • 包含 CQ , 参考 CQ
  • 包含所有 CQ码 的基类:CQTag<T>
  • 包含所有已标明的 CQ码类型约束 , typescript 中可见

Interfaces

  • 仅在 typescript 环境下可用, 包含整个 SDK 中 几乎全部 的接口和类型约束

相关文档