@alemonjs/kook 0.2.6 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -13
- package/dist/assets/index.css +1 -1
- package/dist/assets/index.js +1 -1
- package/lib/desktop.d.ts +2 -2
- package/lib/desktop.js +55 -52
- package/lib/index.d.ts +7 -7
- package/lib/index.js +109 -23
- package/lib/sdk/platform/kook/sdk/api.d.ts +279 -267
- package/lib/sdk/platform/kook/sdk/message/INTERACTION.d.ts +3 -3
- package/lib/sdk/platform/kook/sdk/message/MEMBER_ADD.d.ts +3 -3
- package/lib/sdk/platform/kook/sdk/message/MEMBER_REMOVE.d.ts +3 -3
- package/lib/sdk/platform/kook/sdk/message/MESSAGES_DIRECT.d.ts +3 -3
- package/lib/sdk/platform/kook/sdk/message/MESSAGES_PUBLIC.d.ts +3 -3
- package/lib/sdk/platform/kook/sdk/message/REACTIONS.d.ts +3 -3
- package/lib/sdk/platform/kook/sdk/message.d.ts +15 -15
- package/lib/sdk/platform/kook/sdk/typings.d.ts +167 -138
- package/lib/sdk/platform/kook/sdk/wss.d.ts +22 -22
- package/lib/sdk/platform/kook/sdk/wss.types.d.ts +5 -5
- package/package.json +4 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { MEMBER_ADD_TYPE } from './message/MEMBER_ADD.js'
|
|
2
|
-
import { MEMBER_REMOVE_TYPE } from './message/MEMBER_REMOVE.js'
|
|
3
|
-
import { INTERACTION_TYPE } from './message/INTERACTION.js'
|
|
4
|
-
import { MESSAGES_DIRECT_TYPE } from './message/MESSAGES_DIRECT.js'
|
|
5
|
-
import { MESSAGES_PUBLIC_TYPE } from './message/MESSAGES_PUBLIC.js'
|
|
6
|
-
import { REACTIONS_TYPE } from './message/REACTIONS.js'
|
|
1
|
+
import { MEMBER_ADD_TYPE } from './message/MEMBER_ADD.js'
|
|
2
|
+
import { MEMBER_REMOVE_TYPE } from './message/MEMBER_REMOVE.js'
|
|
3
|
+
import { INTERACTION_TYPE } from './message/INTERACTION.js'
|
|
4
|
+
import { MESSAGES_DIRECT_TYPE } from './message/MESSAGES_DIRECT.js'
|
|
5
|
+
import { MESSAGES_PUBLIC_TYPE } from './message/MESSAGES_PUBLIC.js'
|
|
6
|
+
import { REACTIONS_TYPE } from './message/REACTIONS.js'
|
|
7
7
|
|
|
8
8
|
type KOOKEventMap = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
9
|
+
MEMBER_ADD: MEMBER_ADD_TYPE
|
|
10
|
+
MEMBER_REMOVE: MEMBER_REMOVE_TYPE
|
|
11
|
+
INTERACTION: INTERACTION_TYPE
|
|
12
|
+
MESSAGES_DIRECT: MESSAGES_DIRECT_TYPE
|
|
13
|
+
MESSAGES_PUBLIC: MESSAGES_PUBLIC_TYPE
|
|
14
|
+
REACTIONS: REACTIONS_TYPE
|
|
15
|
+
ERROR: any
|
|
16
|
+
}
|
|
17
17
|
|
|
18
|
-
export type { KOOKEventMap }
|
|
18
|
+
export type { KOOKEventMap }
|
|
@@ -1,192 +1,221 @@
|
|
|
1
|
-
type MessageType = 1 | 2 | 3 | 4 | 8 | 9 | 10 | 255
|
|
1
|
+
type MessageType = 1 | 2 | 3 | 4 | 8 | 9 | 10 | 255
|
|
2
2
|
/**
|
|
3
3
|
* 消息通道类型, GROUP 为组播消息, PERSON 为单播消息, BROADCAST 为广播消息
|
|
4
4
|
*/
|
|
5
|
-
type MessageChannelType = 'GROUP' | 'PERSON' | 'BROADCAST'
|
|
5
|
+
type MessageChannelType = 'GROUP' | 'PERSON' | 'BROADCAST'
|
|
6
6
|
/**
|
|
7
7
|
* 会话数据
|
|
8
8
|
*/
|
|
9
9
|
interface EventData {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
channel_type: MessageChannelType
|
|
11
|
+
type: MessageType
|
|
12
|
+
target_id: string
|
|
13
|
+
author_id: string
|
|
14
|
+
content: string
|
|
15
|
+
extra: Extra
|
|
16
|
+
msg_id: string
|
|
17
|
+
msg_timestamp: number
|
|
18
|
+
nonce: string
|
|
19
|
+
from_type: number
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* 消息发送参数
|
|
23
23
|
*/
|
|
24
24
|
interface SendMessageParams {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
25
|
+
/**
|
|
26
|
+
* 消息类型
|
|
27
|
+
*/
|
|
28
|
+
type?: number
|
|
29
|
+
/**
|
|
30
|
+
* 频道编号
|
|
31
|
+
*/
|
|
32
|
+
target_id: string
|
|
33
|
+
/**
|
|
34
|
+
* 消息内容
|
|
35
|
+
*/
|
|
36
|
+
content: string
|
|
37
|
+
/**
|
|
38
|
+
* 引用--消息id
|
|
39
|
+
*/
|
|
40
|
+
quote?: string
|
|
41
|
+
nonce?: string
|
|
42
|
+
temp_target_id?: string
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
45
|
* 作者信息
|
|
46
46
|
*/
|
|
47
47
|
interface Author {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
48
|
+
id: string
|
|
49
|
+
username: string
|
|
50
|
+
identify_num: string
|
|
51
|
+
online: boolean
|
|
52
|
+
os: string
|
|
53
|
+
status: number
|
|
54
|
+
avatar: string
|
|
55
|
+
vip_avatar: string
|
|
56
|
+
banner: string
|
|
57
|
+
nickname: string
|
|
58
|
+
roles: string[]
|
|
59
|
+
is_vip: boolean
|
|
60
|
+
vip_amp: boolean
|
|
61
|
+
is_ai_reduce_noise: boolean
|
|
62
|
+
is_personal_card_bg: boolean
|
|
63
|
+
bot: boolean
|
|
64
|
+
decorations_id_map: null | unknown
|
|
65
|
+
is_sys: boolean
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
68
|
* mk接口
|
|
69
69
|
*/
|
|
70
70
|
interface KMarkdown {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
raw_content: string
|
|
72
|
+
mention_part: any[]
|
|
73
|
+
mention_role_part: any[]
|
|
74
|
+
channel_part: any[]
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
77
77
|
* 数据包
|
|
78
78
|
*/
|
|
79
79
|
interface Extra {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
80
|
+
type: number
|
|
81
|
+
code: string
|
|
82
|
+
guild_id: string
|
|
83
|
+
guild_type: number
|
|
84
|
+
channel_name: string
|
|
85
|
+
author: Author
|
|
86
|
+
visible_only: null
|
|
87
|
+
mention: any[]
|
|
88
|
+
mention_all: boolean
|
|
89
|
+
mention_roles: any[]
|
|
90
|
+
mention_here: boolean
|
|
91
|
+
nav_channels: any[]
|
|
92
|
+
kmarkdown: KMarkdown
|
|
93
|
+
emoji: any[]
|
|
94
|
+
last_msg_content: string
|
|
95
|
+
send_msg_device: number
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
98
|
* 私聊消息
|
|
99
99
|
*/
|
|
100
100
|
interface SendDirectMessageParams {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
101
|
+
type?: MessageType
|
|
102
|
+
target_id?: string
|
|
103
|
+
chat_code?: string
|
|
104
|
+
content: string
|
|
105
|
+
quote?: string
|
|
106
|
+
nonce?: string
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
109
109
|
* 系统数据
|
|
110
110
|
*/
|
|
111
111
|
interface SystemData {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
112
|
+
channel_type: MessageChannelType
|
|
113
|
+
type: number
|
|
114
|
+
target_id: string
|
|
115
|
+
author_id: string
|
|
116
|
+
content: string
|
|
117
|
+
extra: {
|
|
118
|
+
type: (typeof SystemDataEnum)[number]
|
|
119
|
+
body: overheadData | memberData | ChannelData | StatementData | EditingData | OnLineData
|
|
120
|
+
}
|
|
121
|
+
msg_id: string
|
|
122
|
+
msg_timestamp: number
|
|
123
|
+
nonce: string
|
|
124
|
+
from_type: number
|
|
125
125
|
}
|
|
126
126
|
interface OnLineData {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
user_id: string
|
|
128
|
+
event_time: number
|
|
129
|
+
guilds: any[]
|
|
130
130
|
}
|
|
131
131
|
interface overheadData {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
channel_id: string
|
|
133
|
+
operator_id: string
|
|
134
|
+
msg_id: string
|
|
135
135
|
}
|
|
136
136
|
interface memberData {
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
user_id: string
|
|
138
|
+
exited_at: number
|
|
139
139
|
}
|
|
140
140
|
interface ChannelData {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
141
|
+
id: string
|
|
142
|
+
name: string
|
|
143
|
+
user_id: string
|
|
144
|
+
guild_id: string
|
|
145
|
+
guild_type: number
|
|
146
|
+
limit_amount: number
|
|
147
|
+
is_category: number
|
|
148
|
+
parent_id: string
|
|
149
|
+
level: number
|
|
150
|
+
slow_mode: number
|
|
151
|
+
topic: string
|
|
152
|
+
type: number
|
|
153
|
+
permission_overwrites: any[]
|
|
154
|
+
permission_users: any[]
|
|
155
|
+
permission_sync: number
|
|
156
|
+
mode: number
|
|
157
|
+
has_password: boolean
|
|
158
|
+
last_msg_content: string
|
|
159
|
+
last_msg_id: string
|
|
160
|
+
sync_guild_region: number
|
|
161
|
+
region: string
|
|
162
|
+
joined_at: number
|
|
163
163
|
}
|
|
164
164
|
interface StatementData {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
165
|
+
channel_id: string
|
|
166
|
+
emoji: {
|
|
167
|
+
[key: string]: any
|
|
168
|
+
}
|
|
169
|
+
user_id: string
|
|
170
|
+
msg_id: string
|
|
171
171
|
}
|
|
172
172
|
interface EditingData {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
173
|
+
version_id: string
|
|
174
|
+
channel_id: string
|
|
175
|
+
target_id: string
|
|
176
|
+
content: string
|
|
177
|
+
mention: string[]
|
|
178
|
+
mention_all: boolean
|
|
179
|
+
mention_here: boolean
|
|
180
|
+
mention_roles: string[]
|
|
181
|
+
updated_at: number
|
|
182
|
+
kmarkdown: any
|
|
183
|
+
last_msg_content: string
|
|
184
|
+
embeds: any[]
|
|
185
|
+
msg_id: string
|
|
186
186
|
}
|
|
187
187
|
/**
|
|
188
188
|
* 系统数据可枚举
|
|
189
189
|
*/
|
|
190
|
-
declare const SystemDataEnum: readonly [
|
|
190
|
+
declare const SystemDataEnum: readonly [
|
|
191
|
+
'exited_guild',
|
|
192
|
+
'joined_guild',
|
|
193
|
+
'joined_channel',
|
|
194
|
+
'exited_channel',
|
|
195
|
+
'updated_channel',
|
|
196
|
+
'pinned_message',
|
|
197
|
+
'guild_member_online',
|
|
198
|
+
'added_reaction',
|
|
199
|
+
'deleted_reaction',
|
|
200
|
+
'updated_message',
|
|
201
|
+
'message_btn_click'
|
|
202
|
+
]
|
|
191
203
|
|
|
192
|
-
export {
|
|
204
|
+
export {
|
|
205
|
+
type Author,
|
|
206
|
+
type ChannelData,
|
|
207
|
+
type EditingData,
|
|
208
|
+
type EventData,
|
|
209
|
+
type Extra,
|
|
210
|
+
type KMarkdown,
|
|
211
|
+
type MessageChannelType,
|
|
212
|
+
type MessageType,
|
|
213
|
+
type OnLineData,
|
|
214
|
+
type SendDirectMessageParams,
|
|
215
|
+
type SendMessageParams,
|
|
216
|
+
type StatementData,
|
|
217
|
+
type SystemData,
|
|
218
|
+
SystemDataEnum,
|
|
219
|
+
type memberData,
|
|
220
|
+
type overheadData
|
|
221
|
+
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { KOOKOptions } from './wss.types.js'
|
|
2
|
-
import { KOOKAPI } from './api.js'
|
|
3
|
-
import { KOOKEventMap } from './message.js'
|
|
1
|
+
import { KOOKOptions } from './wss.types.js'
|
|
2
|
+
import { KOOKAPI } from './api.js'
|
|
3
|
+
import { KOOKEventMap } from './message.js'
|
|
4
4
|
|
|
5
5
|
declare class KOOKClient extends KOOKAPI {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
6
|
+
#private
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param opstion
|
|
10
|
+
*/
|
|
11
|
+
constructor(opstion: KOOKOptions)
|
|
12
|
+
/**
|
|
13
|
+
* 注册事件处理程序
|
|
14
|
+
* @param key 事件名称
|
|
15
|
+
* @param val 事件处理函数
|
|
16
|
+
*/
|
|
17
|
+
on<T extends keyof KOOKEventMap>(key: T, val: (event: KOOKEventMap[T]) => any): this
|
|
18
|
+
/**
|
|
19
|
+
* 使用获取到的网关连接地址建立 WebSocket 连接
|
|
20
|
+
* @param token
|
|
21
|
+
* @param conversation
|
|
22
|
+
*/
|
|
23
|
+
connect(): Promise<void>
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export { KOOKClient }
|
|
26
|
+
export { KOOKClient }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alemonjs/kook",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "阿柠檬kook平台连接",
|
|
5
5
|
"author": "lemonade",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,15 +26,18 @@
|
|
|
26
26
|
"value": "@alemonjs/kook"
|
|
27
27
|
}
|
|
28
28
|
],
|
|
29
|
+
"logo": "antd.RobotOutlined",
|
|
29
30
|
"commond": [
|
|
30
31
|
{
|
|
31
32
|
"name": "kook",
|
|
33
|
+
"icon": "antd.RobotOutlined",
|
|
32
34
|
"commond": "open.kook"
|
|
33
35
|
}
|
|
34
36
|
],
|
|
35
37
|
"sidebars": [
|
|
36
38
|
{
|
|
37
39
|
"name": "kook",
|
|
40
|
+
"icon": "antd.RobotOutlined",
|
|
38
41
|
"commond": "open.kook"
|
|
39
42
|
}
|
|
40
43
|
]
|