npm i kaiheila-ws
import { KaiheilaWS } from 'kaiheila-ws'
let kaiheiws = new KaiheilaWS({
type: "Bot",
Bot: {
token: ""
},
retry: true
})
kaiheiws.on("Message", r => { console.log(r) })
kaiheiws.connect()
import { KaiheilaWS } from 'kaiheila-ws'
let kaiheiws = new KaiheilaWS({
type: "User",
User: {
auth: ""
},
retry: true
})
kaiheiws.on("Message", r => { console.log(r) })
kaiheiws.connect()
kaiheiws.sendmsg("Hell yeah!", "8815380044828253")
kaiheiws.getme().then(r=>{console.log(r)})
kaiheiws.getGuilds().then(r=>{console.log(r)})
// 给予角色
kaiheiws.setrole("7430659266664661", "3543259271", 40956, "Grant").then(r=>{console.log(r)})
// 移除角色
kaiheiws.setrole("7430659266664661", "3543259271", 40956, "Revoke").then(r=>{console.log(r)})