Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zhinjs/kook-client
nodejs kook(kaiheila) robot client SDK
https://github.com/zhinjs/kook-client
Last synced: about 1 month ago
JSON representation
nodejs kook(kaiheila) robot client SDK
- Host: GitHub
- URL: https://github.com/zhinjs/kook-client
- Owner: zhinjs
- License: mit
- Created: 2024-07-07T00:50:37.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2024-07-17T02:34:16.000Z (5 months ago)
- Last Synced: 2024-08-05T19:51:06.990Z (5 months ago)
- Language: TypeScript
- Homepage: https://zhinjs.github.io/kook-client/
- Size: 156 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# kook-client
[![CI](https://github.com/zhinjs/kook-client/actions/workflows/release.yaml/badge.svg?branch=master&event=push)](https://github.com/zhinjs/kook-client/actions/workflows/release.yaml)
[![Docs](https://github.com/zhinjs/kook-client/actions/workflows/docs.yaml/badge.svg?branch=master&event=push)](https://github.com/zhinjs/kook-client/actions/workflows/docs.yaml)
[![npm version](https://img.shields.io/npm/v/kook-client/latest.svg)](https://www.npmjs.com/package/kook-client)
[![qq group](https://img.shields.io/badge/group-446290761-blue?style=flat-square&labelColor=FAFAFA&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD4AAAA+CAMAAABEH1h2AAACB1BMVEX///8AAADoHx/6rgjnFhb/tQj9/f3/sggEAgLyICD//vztICAGBgbrHx8MDAwJCQn7rwj09PTi4uKbm5uBgYHvICAREREODg79sQgkJCT39/f/+/HExMT3q6tNTU37vTRFMQI4JwIgFgHt7e3r6+vd3d3b29u7u7uwsLDyenp4eHjxc3NZWVn//fj//PTf399vb29UVFQ8PDwuLi76uCUgICDfHh7oGhoYGBgVFRWjcgf6+vrR0dG2traYmJiUlJRqampiYmJXV1dDQ0M2Njbk5OTX19fKysr+5a70lJTyfX1zc3P90Gz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j0Zg4u9Fuinf3nu8fuHDx4oWB/vO93XETWuSE8Jk9FLzZqPkjE8fZ7UYku53DnCRjszy9pZPT5CCuc4ssfsBoygU3GQ/I4sf7znJGzqSIogfO9h2Xo3c5YOz6pb7uc9pqObJaq9We6+67dH0MHLtkcCsIevll6ke1RBBVa351/myZ+vwSBFll8A4QtZf5oBXpzpZSpJXfmqcOvt+J67WX9EJHNh00SztqhYhrW2g70hzMwutBVE2xhK9c+ExxDXmoPgt3g3SaSDjtNAK37EGDVeSi464iAPkjJwSLwSFEOeFz+3iwyaZOSndFi3WllFK67ORdc3hb94jG7VzR3FL6vXTlQVnjerD5c66MQCMOVOIMDPsZqvZj0laJX9KYEUiigKNiOyBN0nEhvr3CgV6SzBxphE5O4iGglY63ojCfFHbH8oV4A8vU4lFsllX8C4zVMmzDQjwIHYXEPn4fDd/HE8sKOyCz69kJTDM4LYjS8CjgAjGYn2Cp86wjKE8HHapzbQC3ZUQ+FsEtHWAUFeIFDyinER9iVLQOD39hmakJD4zr6JzE84ivzzpNEM2r0+VN7YnXeHbe+vfqVjxnv060N5UrwvkfPWiWue/F51kk3MgKnjaGI2Y8MdxHM47nU74C3abTo3lCnzfqA+zgrDsScc86hHllNE8I6dro/LurQ3q902lxDlmGn/neANEb37NhyxBadur1Q1ff0t/e1Nbu8VRVbd5c1dXlOX3q5ImjR0+cPHXa09WF16o8nva2pnzl9MvKlyGVl5Xl5wtPop+y+TWC/jf9BuxZscgeRqlfAAAAAElFTkSuQmCC&logoColor=000000)](https://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=rYaL-gcqTjWYqwBs9TDoVSXKu-i5ircB&authKey=TO02faBOpfhmfkw3YQuUCG2HxUEwWCuFdMBf5nSt3qyWD%2FqaO453O9Dx%2BK8JwBdM&noverify=0&group_code=446290761)
## 安装依赖```shell
npm i kook-client # or yarn add kook-client
```## 使用
```js
const {Client} = require('kook-client')
// 创建机器人
const client = new Client({
logLevel:'info', // 日志等级
ignore:'bot', // 忽略消息配置,可选值为:bot|self
token:'', // 机器人秘钥
mode:'websocket' // 链接模式
})
// 启动机器人
client.connect()
```## 发送消息
```javascript
const {Client} = require('kook-client')
const client = new Client({
// ...
})
// 只有启动后,才能发送
client.connect().then(() => {
// 频道被动回复
client.on('message.channel', (e) => {
e.reply('hello world')
})
// 频道私信被动回复
client.on('message.private', (e) => {
e.reply('hello world')
})
// 主动发送频道消息
client.sendChannelMsg(channel_id, 'hello')
// 主动发送私聊消息
client.sendPrivateMsg(user_id, 'hello')
})
```## API
文档待更新