Skip to content

zhinjs/kook-client

Repository files navigation

kook-client

CI Docs npm version qq group

安装依赖

npm i kook-client # or yarn add kook-client

使用

const {Client} = require('kook-client')
// 创建机器人
const client = new Client({
	logLevel:'info', // 日志等级
	ignore:'bot', // 忽略消息配置,可选值为:bot|self
	token:'', // 机器人秘钥
	mode:'websocket' // 链接模式
})
// 启动机器人
client.connect()

发送消息

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

文档待更新

Releases

No releases published

Sponsor this project

Packages

No packages published