@alemonjs/kook 2.1.0-alpha.3 → 2.1.0
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/lib/config.d.ts +4 -5
- package/lib/config.js +1 -1
- package/lib/core/config.d.ts +8 -0
- package/lib/core/config.js +0 -23
- package/lib/desktop.d.ts +1 -3
- package/lib/desktop.js +0 -9
- package/lib/hook.d.ts +7 -19
- package/lib/hook.js +0 -10
- package/lib/index.d.ts +5 -6
- package/lib/index.js +396 -242
- package/lib/sdk/api.d.ts +3 -117
- package/lib/sdk/api.js +0 -112
- package/lib/sdk/config.d.ts +4 -0
- package/lib/sdk/conversation.d.ts +35 -0
- package/lib/sdk/conversation.js +24 -49
- package/lib/sdk/index.d.ts +2 -0
- package/lib/sdk/index.js +2 -0
- package/lib/sdk/instance.d.ts +3 -0
- package/lib/sdk/instance.js +12 -28
- package/lib/sdk/message/INTERACTION.d.ts +2 -0
- package/lib/sdk/message/INTERACTION.js +1 -0
- package/lib/sdk/message/MEMBER_ADD.d.ts +2 -0
- package/lib/sdk/message/MEMBER_ADD.js +1 -0
- package/lib/sdk/message/MEMBER_REMOVE.d.ts +2 -0
- package/lib/sdk/message/MEMBER_REMOVE.js +1 -0
- package/lib/sdk/message/MESSAGES_DIRECT.d.ts +2 -0
- package/lib/sdk/message/MESSAGES_DIRECT.js +1 -0
- package/lib/sdk/message/MESSAGES_PUBLIC.d.ts +2 -0
- package/lib/sdk/message/MESSAGES_PUBLIC.js +1 -0
- package/lib/sdk/message/REACTIONS.d.ts +2 -0
- package/lib/sdk/message/REACTIONS.js +1 -0
- package/lib/sdk/message.d.ts +40 -0
- package/lib/sdk/message.js +11 -7
- package/lib/sdk/typings.d.ts +192 -43
- package/lib/sdk/typings.js +19 -89
- package/lib/sdk/wss.d.ts +9 -0
- package/lib/sdk/wss.js +23 -40
- package/lib/sdk/wss.types.d.ts +3 -0
- package/lib/sdk/wss.types.js +1 -0
- package/package.json +3 -3
package/lib/sdk/api.d.ts
CHANGED
|
@@ -1,69 +1,25 @@
|
|
|
1
|
-
import { AxiosRequestConfig } from 'axios';
|
|
1
|
+
import { type AxiosRequestConfig } from 'axios';
|
|
2
2
|
import { Readable } from 'stream';
|
|
3
3
|
import { SendMessageParams, SendDirectMessageParams } from './typings.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* api接口
|
|
7
|
-
*/
|
|
8
|
-
declare class KOOKAPI {
|
|
9
|
-
/**
|
|
10
|
-
* KOOK服务
|
|
11
|
-
* @param config
|
|
12
|
-
* @returns
|
|
13
|
-
*/
|
|
4
|
+
export declare const API_URL = "https://www.kookapp.cn";
|
|
5
|
+
export declare class KOOKAPI {
|
|
14
6
|
service(opstoin: AxiosRequestConfig): Promise<any>;
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
* @returns
|
|
18
|
-
*/
|
|
19
7
|
gateway(): Promise<any>;
|
|
20
|
-
/**
|
|
21
|
-
* ************
|
|
22
|
-
* 资源床单
|
|
23
|
-
* ***********
|
|
24
|
-
*/
|
|
25
|
-
/**
|
|
26
|
-
* 发送buffer资源
|
|
27
|
-
* @param id 私信传频道id,公信传子频道id
|
|
28
|
-
* @param message {消息编号,图片,内容}
|
|
29
|
-
* @returns
|
|
30
|
-
*/
|
|
31
8
|
postImage(file: string | Buffer | Readable, Name?: string): Promise<false | {
|
|
32
9
|
data: {
|
|
33
10
|
url: string;
|
|
34
11
|
};
|
|
35
12
|
}>;
|
|
36
|
-
/**
|
|
37
|
-
* 发送buffer资源
|
|
38
|
-
* @param id 私信传频道id,公信传子频道id
|
|
39
|
-
* @param message {消息编号,图片,内容}
|
|
40
|
-
* @returns
|
|
41
|
-
*/
|
|
42
13
|
postFile(file: Buffer, Name?: string): Promise<false | {
|
|
43
14
|
data: {
|
|
44
15
|
url: string;
|
|
45
16
|
};
|
|
46
17
|
}>;
|
|
47
|
-
/**
|
|
48
|
-
* 转存
|
|
49
|
-
* @param formdata
|
|
50
|
-
* @returns
|
|
51
|
-
*/
|
|
52
18
|
createUrl(formdata: any): Promise<{
|
|
53
19
|
data: {
|
|
54
20
|
url: string;
|
|
55
21
|
};
|
|
56
22
|
}>;
|
|
57
|
-
/**
|
|
58
|
-
* *********
|
|
59
|
-
* 消息api
|
|
60
|
-
* *********
|
|
61
|
-
*/
|
|
62
|
-
/**
|
|
63
|
-
* 创建消息
|
|
64
|
-
* @param data
|
|
65
|
-
* @returns
|
|
66
|
-
*/
|
|
67
23
|
createMessage(data: SendMessageParams): Promise<{
|
|
68
24
|
data: {
|
|
69
25
|
msg_id: string;
|
|
@@ -71,14 +27,6 @@ declare class KOOKAPI {
|
|
|
71
27
|
nonce: string;
|
|
72
28
|
};
|
|
73
29
|
}>;
|
|
74
|
-
/**
|
|
75
|
-
* 创建私聊消息
|
|
76
|
-
*/
|
|
77
|
-
/**
|
|
78
|
-
* 创建消息
|
|
79
|
-
* @param target_id
|
|
80
|
-
* @returns
|
|
81
|
-
*/
|
|
82
30
|
userChatCreate(target_id: string): Promise<{
|
|
83
31
|
data: {
|
|
84
32
|
code: string;
|
|
@@ -96,11 +44,6 @@ declare class KOOKAPI {
|
|
|
96
44
|
};
|
|
97
45
|
};
|
|
98
46
|
}>;
|
|
99
|
-
/**
|
|
100
|
-
* 创建消息
|
|
101
|
-
* @param data
|
|
102
|
-
* @returns
|
|
103
|
-
*/
|
|
104
47
|
createDirectMessage(data: SendDirectMessageParams): Promise<{
|
|
105
48
|
data: {
|
|
106
49
|
msg_id: string;
|
|
@@ -108,11 +51,6 @@ declare class KOOKAPI {
|
|
|
108
51
|
nonce: string;
|
|
109
52
|
};
|
|
110
53
|
}>;
|
|
111
|
-
/**
|
|
112
|
-
* 删除指定消息
|
|
113
|
-
* @param msg_id
|
|
114
|
-
* @returns
|
|
115
|
-
*/
|
|
116
54
|
messageDelete(msg_id: string): Promise<{
|
|
117
55
|
data: {
|
|
118
56
|
code: number;
|
|
@@ -120,11 +58,6 @@ declare class KOOKAPI {
|
|
|
120
58
|
data: any[];
|
|
121
59
|
};
|
|
122
60
|
}>;
|
|
123
|
-
/**
|
|
124
|
-
* 重编辑指定消息
|
|
125
|
-
* @param data
|
|
126
|
-
* @returns
|
|
127
|
-
*/
|
|
128
61
|
messageUpdate(data: {
|
|
129
62
|
msg_id: string;
|
|
130
63
|
content: any;
|
|
@@ -137,11 +70,6 @@ declare class KOOKAPI {
|
|
|
137
70
|
data: any[];
|
|
138
71
|
};
|
|
139
72
|
}>;
|
|
140
|
-
/**
|
|
141
|
-
* 删回应
|
|
142
|
-
* @param data
|
|
143
|
-
* @returns
|
|
144
|
-
*/
|
|
145
73
|
messageDeleteReaction(data: {
|
|
146
74
|
msg_id: string;
|
|
147
75
|
emoji: string;
|
|
@@ -151,11 +79,6 @@ declare class KOOKAPI {
|
|
|
151
79
|
message: string;
|
|
152
80
|
data: any[];
|
|
153
81
|
}>;
|
|
154
|
-
/**
|
|
155
|
-
* 发回应
|
|
156
|
-
* @param data
|
|
157
|
-
* @returns
|
|
158
|
-
*/
|
|
159
82
|
messageAddReaction(data: {
|
|
160
83
|
msg_id: string;
|
|
161
84
|
emoji: string;
|
|
@@ -164,11 +87,6 @@ declare class KOOKAPI {
|
|
|
164
87
|
message: string;
|
|
165
88
|
data: any[];
|
|
166
89
|
}>;
|
|
167
|
-
/**
|
|
168
|
-
* 某个回应的所有用户
|
|
169
|
-
* @param data
|
|
170
|
-
* @returns
|
|
171
|
-
*/
|
|
172
90
|
messageReactionList(params: {
|
|
173
91
|
msg_id: string;
|
|
174
92
|
emoji: string;
|
|
@@ -191,17 +109,6 @@ declare class KOOKAPI {
|
|
|
191
109
|
reaction_time: number;
|
|
192
110
|
};
|
|
193
111
|
}>;
|
|
194
|
-
/**
|
|
195
|
-
* **********
|
|
196
|
-
* user
|
|
197
|
-
* *********
|
|
198
|
-
*/
|
|
199
|
-
/**
|
|
200
|
-
* 得到当前信息
|
|
201
|
-
* @param guild_id
|
|
202
|
-
* @param user_id
|
|
203
|
-
* @returns
|
|
204
|
-
*/
|
|
205
112
|
userMe(): Promise<{
|
|
206
113
|
code: number;
|
|
207
114
|
message: string;
|
|
@@ -222,12 +129,6 @@ declare class KOOKAPI {
|
|
|
222
129
|
invited_count: number;
|
|
223
130
|
};
|
|
224
131
|
}>;
|
|
225
|
-
/**
|
|
226
|
-
* 得到用户信息
|
|
227
|
-
* @param guild_id
|
|
228
|
-
* @param user_id
|
|
229
|
-
* @returns
|
|
230
|
-
*/
|
|
231
132
|
userView(guild_id: string, user_id: string): Promise<{
|
|
232
133
|
code: number;
|
|
233
134
|
message: string;
|
|
@@ -246,29 +147,14 @@ declare class KOOKAPI {
|
|
|
246
147
|
active_time: number;
|
|
247
148
|
};
|
|
248
149
|
}>;
|
|
249
|
-
/**
|
|
250
|
-
* 踢出
|
|
251
|
-
* @param guild_id
|
|
252
|
-
* @param user_id
|
|
253
|
-
* @returns
|
|
254
|
-
*/
|
|
255
150
|
guildKickout(guild_id: string, user_id: string): Promise<{
|
|
256
151
|
code: number;
|
|
257
152
|
message: string;
|
|
258
153
|
data: any;
|
|
259
154
|
}>;
|
|
260
|
-
/**
|
|
261
|
-
* 创建角色
|
|
262
|
-
* @param channel_id
|
|
263
|
-
* @param type
|
|
264
|
-
* @param value
|
|
265
|
-
* @returns
|
|
266
|
-
*/
|
|
267
155
|
channelRoleCreate(channel_id: string, type: string, value: string): Promise<{
|
|
268
156
|
code: number;
|
|
269
157
|
message: string;
|
|
270
158
|
data: any;
|
|
271
159
|
}>;
|
|
272
160
|
}
|
|
273
|
-
|
|
274
|
-
export { KOOKAPI };
|
package/lib/sdk/api.js
CHANGED
|
@@ -6,15 +6,7 @@ import { createPicFrom } from 'alemonjs/utils';
|
|
|
6
6
|
import { createAxiosInstance } from './instance.js';
|
|
7
7
|
|
|
8
8
|
const API_URL = 'https://www.kookapp.cn';
|
|
9
|
-
/**
|
|
10
|
-
* api接口
|
|
11
|
-
*/
|
|
12
9
|
class KOOKAPI {
|
|
13
|
-
/**
|
|
14
|
-
* KOOK服务
|
|
15
|
-
* @param config
|
|
16
|
-
* @returns
|
|
17
|
-
*/
|
|
18
10
|
service(opstoin) {
|
|
19
11
|
const token = config.get('token');
|
|
20
12
|
const req = axios.create({
|
|
@@ -26,10 +18,6 @@ class KOOKAPI {
|
|
|
26
18
|
});
|
|
27
19
|
return createAxiosInstance(req, opstoin);
|
|
28
20
|
}
|
|
29
|
-
/**
|
|
30
|
-
*
|
|
31
|
-
* @returns
|
|
32
|
-
*/
|
|
33
21
|
gateway() {
|
|
34
22
|
return this.service({
|
|
35
23
|
baseURL: 'https://www.kookapp.cn/api/v3/gateway/index',
|
|
@@ -39,17 +27,6 @@ class KOOKAPI {
|
|
|
39
27
|
}
|
|
40
28
|
});
|
|
41
29
|
}
|
|
42
|
-
/**
|
|
43
|
-
* ************
|
|
44
|
-
* 资源床单
|
|
45
|
-
* ***********
|
|
46
|
-
*/
|
|
47
|
-
/**
|
|
48
|
-
* 发送buffer资源
|
|
49
|
-
* @param id 私信传频道id,公信传子频道id
|
|
50
|
-
* @param message {消息编号,图片,内容}
|
|
51
|
-
* @returns
|
|
52
|
-
*/
|
|
53
30
|
async postImage(file, Name = 'image.jpg') {
|
|
54
31
|
const from = await createPicFrom({
|
|
55
32
|
image: file,
|
|
@@ -67,12 +44,6 @@ class KOOKAPI {
|
|
|
67
44
|
}
|
|
68
45
|
return false;
|
|
69
46
|
}
|
|
70
|
-
/**
|
|
71
|
-
* 发送buffer资源
|
|
72
|
-
* @param id 私信传频道id,公信传子频道id
|
|
73
|
-
* @param message {消息编号,图片,内容}
|
|
74
|
-
* @returns
|
|
75
|
-
*/
|
|
76
47
|
async postFile(file, Name = 'image.jpg') {
|
|
77
48
|
const formdata = new FormData();
|
|
78
49
|
formdata.append('file', [file], Name);
|
|
@@ -82,11 +53,6 @@ class KOOKAPI {
|
|
|
82
53
|
}
|
|
83
54
|
return false;
|
|
84
55
|
}
|
|
85
|
-
/**
|
|
86
|
-
* 转存
|
|
87
|
-
* @param formdata
|
|
88
|
-
* @returns
|
|
89
|
-
*/
|
|
90
56
|
async createUrl(formdata) {
|
|
91
57
|
return await this.service({
|
|
92
58
|
method: 'post',
|
|
@@ -95,16 +61,6 @@ class KOOKAPI {
|
|
|
95
61
|
headers: formdata.getHeaders()
|
|
96
62
|
});
|
|
97
63
|
}
|
|
98
|
-
/**
|
|
99
|
-
* *********
|
|
100
|
-
* 消息api
|
|
101
|
-
* *********
|
|
102
|
-
*/
|
|
103
|
-
/**
|
|
104
|
-
* 创建消息
|
|
105
|
-
* @param data
|
|
106
|
-
* @returns
|
|
107
|
-
*/
|
|
108
64
|
async createMessage(data) {
|
|
109
65
|
return await this.service({
|
|
110
66
|
method: 'post',
|
|
@@ -112,14 +68,6 @@ class KOOKAPI {
|
|
|
112
68
|
data
|
|
113
69
|
});
|
|
114
70
|
}
|
|
115
|
-
/**
|
|
116
|
-
* 创建私聊消息
|
|
117
|
-
*/
|
|
118
|
-
/**
|
|
119
|
-
* 创建消息
|
|
120
|
-
* @param target_id
|
|
121
|
-
* @returns
|
|
122
|
-
*/
|
|
123
71
|
userChatCreate(target_id) {
|
|
124
72
|
return this.service({
|
|
125
73
|
method: 'post',
|
|
@@ -129,11 +77,6 @@ class KOOKAPI {
|
|
|
129
77
|
}
|
|
130
78
|
});
|
|
131
79
|
}
|
|
132
|
-
/**
|
|
133
|
-
* 创建消息
|
|
134
|
-
* @param data
|
|
135
|
-
* @returns
|
|
136
|
-
*/
|
|
137
80
|
createDirectMessage(data) {
|
|
138
81
|
return this.service({
|
|
139
82
|
method: 'post',
|
|
@@ -141,11 +84,6 @@ class KOOKAPI {
|
|
|
141
84
|
data
|
|
142
85
|
});
|
|
143
86
|
}
|
|
144
|
-
/**
|
|
145
|
-
* 删除指定消息
|
|
146
|
-
* @param msg_id
|
|
147
|
-
* @returns
|
|
148
|
-
*/
|
|
149
87
|
messageDelete(msg_id) {
|
|
150
88
|
return this.service({
|
|
151
89
|
method: 'post',
|
|
@@ -155,11 +93,6 @@ class KOOKAPI {
|
|
|
155
93
|
}
|
|
156
94
|
});
|
|
157
95
|
}
|
|
158
|
-
/**
|
|
159
|
-
* 重编辑指定消息
|
|
160
|
-
* @param data
|
|
161
|
-
* @returns
|
|
162
|
-
*/
|
|
163
96
|
messageUpdate(data) {
|
|
164
97
|
return this.service({
|
|
165
98
|
method: 'post',
|
|
@@ -167,11 +100,6 @@ class KOOKAPI {
|
|
|
167
100
|
data
|
|
168
101
|
});
|
|
169
102
|
}
|
|
170
|
-
/**
|
|
171
|
-
* 删回应
|
|
172
|
-
* @param data
|
|
173
|
-
* @returns
|
|
174
|
-
*/
|
|
175
103
|
messageDeleteReaction(data) {
|
|
176
104
|
return this.service({
|
|
177
105
|
method: 'post',
|
|
@@ -179,11 +107,6 @@ class KOOKAPI {
|
|
|
179
107
|
data
|
|
180
108
|
});
|
|
181
109
|
}
|
|
182
|
-
/**
|
|
183
|
-
* 发回应
|
|
184
|
-
* @param data
|
|
185
|
-
* @returns
|
|
186
|
-
*/
|
|
187
110
|
messageAddReaction(data) {
|
|
188
111
|
return this.service({
|
|
189
112
|
method: 'post',
|
|
@@ -191,11 +114,6 @@ class KOOKAPI {
|
|
|
191
114
|
data
|
|
192
115
|
});
|
|
193
116
|
}
|
|
194
|
-
/**
|
|
195
|
-
* 某个回应的所有用户
|
|
196
|
-
* @param data
|
|
197
|
-
* @returns
|
|
198
|
-
*/
|
|
199
117
|
messageReactionList(params) {
|
|
200
118
|
return this.service({
|
|
201
119
|
method: 'get',
|
|
@@ -203,29 +121,12 @@ class KOOKAPI {
|
|
|
203
121
|
params
|
|
204
122
|
});
|
|
205
123
|
}
|
|
206
|
-
/**
|
|
207
|
-
* **********
|
|
208
|
-
* user
|
|
209
|
-
* *********
|
|
210
|
-
*/
|
|
211
|
-
/**
|
|
212
|
-
* 得到当前信息
|
|
213
|
-
* @param guild_id
|
|
214
|
-
* @param user_id
|
|
215
|
-
* @returns
|
|
216
|
-
*/
|
|
217
124
|
userMe() {
|
|
218
125
|
return this.service({
|
|
219
126
|
method: 'get',
|
|
220
127
|
url: ApiEnum.UserMe
|
|
221
128
|
});
|
|
222
129
|
}
|
|
223
|
-
/**
|
|
224
|
-
* 得到用户信息
|
|
225
|
-
* @param guild_id
|
|
226
|
-
* @param user_id
|
|
227
|
-
* @returns
|
|
228
|
-
*/
|
|
229
130
|
userView(guild_id, user_id) {
|
|
230
131
|
return this.service({
|
|
231
132
|
method: 'get',
|
|
@@ -236,12 +137,6 @@ class KOOKAPI {
|
|
|
236
137
|
}
|
|
237
138
|
});
|
|
238
139
|
}
|
|
239
|
-
/**
|
|
240
|
-
* 踢出
|
|
241
|
-
* @param guild_id
|
|
242
|
-
* @param user_id
|
|
243
|
-
* @returns
|
|
244
|
-
*/
|
|
245
140
|
guildKickout(guild_id, user_id) {
|
|
246
141
|
return this.service({
|
|
247
142
|
method: 'post',
|
|
@@ -252,13 +147,6 @@ class KOOKAPI {
|
|
|
252
147
|
}
|
|
253
148
|
});
|
|
254
149
|
}
|
|
255
|
-
/**
|
|
256
|
-
* 创建角色
|
|
257
|
-
* @param channel_id
|
|
258
|
-
* @param type
|
|
259
|
-
* @param value
|
|
260
|
-
* @returns
|
|
261
|
-
*/
|
|
262
150
|
channelRoleCreate(channel_id, type, value) {
|
|
263
151
|
return this.service({
|
|
264
152
|
method: 'post',
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { SystemData } from './typings.js';
|
|
2
|
+
export declare const ConversationMap: {
|
|
3
|
+
1: {
|
|
4
|
+
public: () => string;
|
|
5
|
+
direct: () => string;
|
|
6
|
+
};
|
|
7
|
+
2: {
|
|
8
|
+
public: () => string;
|
|
9
|
+
direct: () => string;
|
|
10
|
+
};
|
|
11
|
+
3: {
|
|
12
|
+
public: () => string;
|
|
13
|
+
direct: () => string;
|
|
14
|
+
};
|
|
15
|
+
4: {
|
|
16
|
+
public: () => string;
|
|
17
|
+
direct: () => string;
|
|
18
|
+
};
|
|
19
|
+
8: {
|
|
20
|
+
public: () => string;
|
|
21
|
+
direct: () => string;
|
|
22
|
+
};
|
|
23
|
+
9: {
|
|
24
|
+
public: () => string;
|
|
25
|
+
direct: () => string;
|
|
26
|
+
};
|
|
27
|
+
10: {
|
|
28
|
+
public: () => string;
|
|
29
|
+
direct: () => string;
|
|
30
|
+
};
|
|
31
|
+
255: {
|
|
32
|
+
public: (event: SystemData) => string;
|
|
33
|
+
direct: (event: SystemData) => string;
|
|
34
|
+
};
|
|
35
|
+
};
|
package/lib/sdk/conversation.js
CHANGED
|
@@ -1,62 +1,34 @@
|
|
|
1
1
|
import { KOOKEventKey } from './message.js';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* 事件处理集
|
|
5
|
-
*/
|
|
6
3
|
const ConversationMap = {
|
|
7
|
-
/**
|
|
8
|
-
* 文字消息
|
|
9
|
-
*/
|
|
10
4
|
[1]: {
|
|
11
5
|
public: () => KOOKEventKey['MESSAGES_PUBLIC'],
|
|
12
6
|
direct: () => KOOKEventKey['MESSAGES_DIRECT']
|
|
13
7
|
},
|
|
14
|
-
/**
|
|
15
|
-
* 图片消息,
|
|
16
|
-
*/
|
|
17
8
|
[2]: {
|
|
18
9
|
public: () => KOOKEventKey['MESSAGES_PUBLIC'],
|
|
19
10
|
direct: () => KOOKEventKey['MESSAGES_DIRECT']
|
|
20
11
|
},
|
|
21
|
-
/**
|
|
22
|
-
* 视频消息,
|
|
23
|
-
*/
|
|
24
12
|
[3]: {
|
|
25
13
|
public: () => KOOKEventKey['MESSAGES_PUBLIC'],
|
|
26
14
|
direct: () => KOOKEventKey['MESSAGES_DIRECT']
|
|
27
15
|
},
|
|
28
|
-
/**
|
|
29
|
-
* 文件消息,
|
|
30
|
-
*/
|
|
31
16
|
[4]: {
|
|
32
17
|
public: () => KOOKEventKey['MESSAGES_PUBLIC'],
|
|
33
18
|
direct: () => KOOKEventKey['MESSAGES_DIRECT']
|
|
34
19
|
},
|
|
35
|
-
/**
|
|
36
|
-
* 音频消息,
|
|
37
|
-
*/
|
|
38
20
|
[8]: {
|
|
39
21
|
public: () => KOOKEventKey['MESSAGES_PUBLIC'],
|
|
40
22
|
direct: () => KOOKEventKey['MESSAGES_DIRECT']
|
|
41
23
|
},
|
|
42
|
-
/**
|
|
43
|
-
* mk消息
|
|
44
|
-
*/
|
|
45
24
|
[9]: {
|
|
46
25
|
public: () => KOOKEventKey['MESSAGES_PUBLIC'],
|
|
47
26
|
direct: () => KOOKEventKey['MESSAGES_DIRECT']
|
|
48
27
|
},
|
|
49
|
-
/**
|
|
50
|
-
* card消息,
|
|
51
|
-
*/
|
|
52
28
|
[10]: {
|
|
53
29
|
public: () => KOOKEventKey['MESSAGES_PUBLIC'],
|
|
54
30
|
direct: () => KOOKEventKey['MESSAGES_DIRECT']
|
|
55
31
|
},
|
|
56
|
-
/**
|
|
57
|
-
* 系统消息
|
|
58
|
-
* @param event
|
|
59
|
-
*/
|
|
60
32
|
[255]: {
|
|
61
33
|
public: (event) => {
|
|
62
34
|
if (event.extra.type === 'added_reaction' || event.extra.type === 'deleted_reaction') {
|
|
@@ -67,18 +39,12 @@ const ConversationMap = {
|
|
|
67
39
|
return '';
|
|
68
40
|
}
|
|
69
41
|
else if (event.extra.type === 'exited_channel') {
|
|
70
|
-
console.info('
|
|
42
|
+
console.info('exited_channel');
|
|
71
43
|
return '';
|
|
72
44
|
}
|
|
73
45
|
else if (event.extra.type === 'updated_channel') {
|
|
74
|
-
// ChannelData
|
|
75
46
|
console.info('updated_channel');
|
|
76
|
-
return '';
|
|
77
|
-
/**
|
|
78
|
-
* ***********
|
|
79
|
-
* 频道进出
|
|
80
|
-
* *******
|
|
81
|
-
*/
|
|
47
|
+
return KOOKEventKey['CHANNEL_UPDATE'];
|
|
82
48
|
}
|
|
83
49
|
else if (event.extra.type === 'joined_guild') {
|
|
84
50
|
console.info('joined_guild');
|
|
@@ -87,33 +53,42 @@ const ConversationMap = {
|
|
|
87
53
|
else if (event.extra.type === 'exited_guild') {
|
|
88
54
|
console.info('exited_guild');
|
|
89
55
|
return KOOKEventKey['MEMBER_REMOVE'];
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
56
|
+
}
|
|
57
|
+
else if (event.extra.type === 'self_joined_guild') {
|
|
58
|
+
console.info('self_joined_guild');
|
|
59
|
+
return KOOKEventKey['GUILD_JOIN'];
|
|
60
|
+
}
|
|
61
|
+
else if (event.extra.type === 'self_exited_guild') {
|
|
62
|
+
console.info('self_exited_guild');
|
|
63
|
+
return KOOKEventKey['GUILD_EXIT'];
|
|
64
|
+
}
|
|
65
|
+
else if (event.extra.type === 'added_channel') {
|
|
66
|
+
console.info('added_channel');
|
|
67
|
+
return KOOKEventKey['CHANNEL_CREATE'];
|
|
68
|
+
}
|
|
69
|
+
else if (event.extra.type === 'deleted_channel') {
|
|
70
|
+
console.info('deleted_channel');
|
|
71
|
+
return KOOKEventKey['CHANNEL_DELETE'];
|
|
95
72
|
}
|
|
96
73
|
else if (event.extra.type === 'updated_message') {
|
|
97
|
-
// 消息更新
|
|
98
|
-
// EditingData
|
|
99
74
|
console.info('updated_message');
|
|
100
|
-
return '';
|
|
75
|
+
return KOOKEventKey['MESSAGES_UPDATE'];
|
|
76
|
+
}
|
|
77
|
+
else if (event.extra.type === 'deleted_message') {
|
|
78
|
+
console.info('deleted_message');
|
|
79
|
+
return KOOKEventKey['MESSAGES_DELETE'];
|
|
101
80
|
}
|
|
102
81
|
else if (event.extra.type === 'pinned_message') {
|
|
103
|
-
// 顶置消息
|
|
104
|
-
// overheadData
|
|
105
82
|
console.info('pinned_message');
|
|
106
|
-
return '';
|
|
83
|
+
return KOOKEventKey['MESSAGES_PIN'];
|
|
107
84
|
}
|
|
108
85
|
},
|
|
109
86
|
direct: (event) => {
|
|
110
87
|
if (event.extra.type === 'guild_member_online') {
|
|
111
|
-
// OnLineData
|
|
112
88
|
console.info('exited_guild');
|
|
113
89
|
return '';
|
|
114
90
|
}
|
|
115
91
|
else if (event.extra.type === 'message_btn_click') {
|
|
116
|
-
// 按钮事件
|
|
117
92
|
console.info('message_btn_click');
|
|
118
93
|
return KOOKEventKey['INTERACTION'];
|
|
119
94
|
}
|
package/lib/sdk/index.js
ADDED