-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdebug.ts
47 lines (36 loc) · 897 Bytes
/
debug.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { CQWebSocket } from './src/CQWebsocket'
const bot = new CQWebSocket({
host: 'localhost',
port: 8080,
accessToken: ''
})
bot.on('socket.connecting', function () {
console.log(`连接中[/api]`)
})
bot.on('socket.connectingEvent', function () {
console.log(`连接中[/event]`)
})
bot.on('socket.error', function ({ context }) {
console.log(`连接失败[/api]`)
console.log(context)
})
bot.on('socket.errorEvent', function ({ context }) {
console.log(`连接失败[/event]`)
console.log(context)
})
bot.on('socket.open', async function () {
console.log(`连接成功[/api]`)
})
bot.on('socket.openEvent', async function () {
console.log(`连接成功[/event]`)
})
bot.on('message', async event => {
console.log(event)
})
bot.on('notice', async event => {
console.log(event)
})
bot.on('request', async event => {
console.log(event)
})
bot.connect()