@alemonjs/discord 0.0.4 → 0.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/index.d.ts +5 -1
- package/lib/index.js +24 -5
- package/lib/sdk/core/config.js +46 -0
- package/lib/sdk/core/utils/from.js +42 -0
- package/lib/sdk/platform/discord/sdk/api.d.ts +896 -0
- package/lib/sdk/platform/discord/sdk/api.js +1554 -0
- package/lib/sdk/platform/discord/sdk/config.js +29 -0
- package/lib/sdk/platform/discord/sdk/intents.js +36 -0
- package/lib/sdk/platform/discord/sdk/message/CHANNEL_TOPIC_UPDATE.d.ts +11 -0
- package/lib/sdk/platform/discord/sdk/message/CHANNEL_UPDATE.d.ts +48 -0
- package/lib/sdk/platform/discord/sdk/message/GUILD_MEMBER_ADD.d.ts +28 -0
- package/lib/sdk/platform/discord/sdk/message/GUILD_MEMBER_REMOVE.d.ts +18 -0
- package/lib/sdk/platform/discord/sdk/message/GUILD_MEMBER_UPDATE.d.ts +33 -0
- package/lib/sdk/platform/discord/sdk/message/MESSAGE_CREATE.d.ts +59 -0
- package/lib/sdk/platform/discord/sdk/message/MESSAGE_DELETE.d.ts +11 -0
- package/lib/sdk/platform/discord/sdk/message/MESSAGE_REACTION_ADD.d.ts +42 -0
- package/lib/sdk/platform/discord/sdk/message/MESSAGE_UPDATE.d.ts +56 -0
- package/lib/sdk/platform/discord/sdk/message/PRESENCE_UPDATE.d.ts +63 -0
- package/lib/sdk/platform/discord/sdk/message/READY.d.ts +9 -0
- package/lib/sdk/platform/discord/sdk/message/TYPING_START.d.ts +35 -0
- package/lib/sdk/platform/discord/sdk/message/VOICE_CHANNEL_STATUS_UPDATE.d.ts +10 -0
- package/lib/sdk/platform/discord/sdk/message/VOICE_STATE_UPDATE.d.ts +41 -0
- package/lib/sdk/platform/discord/sdk/message.d.ts +37 -0
- package/lib/sdk/platform/discord/sdk/types.d.ts +4 -0
- package/lib/sdk/platform/discord/sdk/wss.d.ts +27 -0
- package/lib/sdk/platform/discord/sdk/wss.js +201 -0
- package/lib/sdk/platform/discord/sdk/wss.types.d.ts +26 -0
- package/package.json +5 -7
|
@@ -0,0 +1,1554 @@
|
|
|
1
|
+
import FormData from 'form-data';
|
|
2
|
+
import 'fs';
|
|
3
|
+
import axios from 'axios';
|
|
4
|
+
import 'path';
|
|
5
|
+
import 'qrcode';
|
|
6
|
+
import 'public-ip';
|
|
7
|
+
import { createPicFrom } from '../../../core/utils/from.js';
|
|
8
|
+
import { config } from './config.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* api接口
|
|
12
|
+
*/
|
|
13
|
+
class DCAPI {
|
|
14
|
+
API_URL = 'https://discord.com/api/v10';
|
|
15
|
+
CDB_URL = 'https://cdn.discordapp.com';
|
|
16
|
+
/**
|
|
17
|
+
* 基础请求
|
|
18
|
+
* @param opstion
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
request(options) {
|
|
22
|
+
const token = config.get('token');
|
|
23
|
+
const service = axios.create({
|
|
24
|
+
baseURL: this.API_URL,
|
|
25
|
+
timeout: 6000,
|
|
26
|
+
headers: {
|
|
27
|
+
'Content-Type': 'application/json',
|
|
28
|
+
'Authorization': `Bot ${token}`
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
return service(options);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* cdn基础请求
|
|
35
|
+
* @param options
|
|
36
|
+
* @returns
|
|
37
|
+
*/
|
|
38
|
+
requestCDN(options) {
|
|
39
|
+
const token = config.get('token');
|
|
40
|
+
const service = axios.create({
|
|
41
|
+
baseURL: this.CDB_URL,
|
|
42
|
+
timeout: 6000,
|
|
43
|
+
headers: {
|
|
44
|
+
'Content-Type': 'application/json',
|
|
45
|
+
'Authorization': `Bot ${token}`
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return service(options);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 创建用户url地址
|
|
52
|
+
* @param user_id
|
|
53
|
+
* @param avatar_hash
|
|
54
|
+
* @returns
|
|
55
|
+
*/
|
|
56
|
+
userAvatar(user_id, avatar_hash) {
|
|
57
|
+
return `${this.CDB_URL}/avatars/${user_id}/${avatar_hash}.png`;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
*
|
|
61
|
+
* @param user_id
|
|
62
|
+
* @param avatar_hash
|
|
63
|
+
* @returns
|
|
64
|
+
*/
|
|
65
|
+
async getUserUrl(user_id, avatar_hash) {
|
|
66
|
+
const url = `/avatars/${user_id}/${avatar_hash}.png`;
|
|
67
|
+
return this.requestCDN({
|
|
68
|
+
url: url,
|
|
69
|
+
method: 'get'
|
|
70
|
+
}).then(res => res?.data);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
*
|
|
74
|
+
* @param user_id
|
|
75
|
+
* @param avatar_hash
|
|
76
|
+
* @returns
|
|
77
|
+
*/
|
|
78
|
+
async channelsMessages(channel_id, data, headers) {
|
|
79
|
+
return this.request({
|
|
80
|
+
url: `channels/${channel_id}/messages`,
|
|
81
|
+
method: 'post',
|
|
82
|
+
headers: headers,
|
|
83
|
+
data
|
|
84
|
+
}).then(res => res?.data);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
*
|
|
88
|
+
* @param channel_id
|
|
89
|
+
* @param img
|
|
90
|
+
* @returns
|
|
91
|
+
*/
|
|
92
|
+
async channelsMessagesImage(channel_id, img, content) {
|
|
93
|
+
const from = await createPicFrom(img);
|
|
94
|
+
if (!from)
|
|
95
|
+
return;
|
|
96
|
+
const { picData, name } = from;
|
|
97
|
+
const formData = new FormData();
|
|
98
|
+
if (content) {
|
|
99
|
+
formData.append('content', content);
|
|
100
|
+
}
|
|
101
|
+
formData.append('file', picData, name);
|
|
102
|
+
return this.request({
|
|
103
|
+
method: 'post',
|
|
104
|
+
url: `channels/${channel_id}/messages`,
|
|
105
|
+
data: formData,
|
|
106
|
+
headers: {
|
|
107
|
+
'Content-Type': 'multipart/form-data'
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* ************
|
|
113
|
+
* 消息-图片接口
|
|
114
|
+
* ***********
|
|
115
|
+
*/
|
|
116
|
+
/**
|
|
117
|
+
* 创建form
|
|
118
|
+
* @param image
|
|
119
|
+
* @param msg_id
|
|
120
|
+
* @param content
|
|
121
|
+
* @param name
|
|
122
|
+
* @returns
|
|
123
|
+
*/
|
|
124
|
+
async createFrom(image, msg_id, content, Name = 'image.jpg') {
|
|
125
|
+
const from = await createPicFrom(image, Name);
|
|
126
|
+
if (!from)
|
|
127
|
+
return false;
|
|
128
|
+
const { picData, name } = from;
|
|
129
|
+
const formdata = new FormData();
|
|
130
|
+
formdata.append('msg_id', msg_id);
|
|
131
|
+
if (typeof content === 'string')
|
|
132
|
+
formdata.append('content', content);
|
|
133
|
+
formdata.append('file_image', picData, name);
|
|
134
|
+
return formdata;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* 发送buffer图片
|
|
138
|
+
* @param id 传子频道id
|
|
139
|
+
* @param message {消息编号,图片,内容}
|
|
140
|
+
* @returns
|
|
141
|
+
*/
|
|
142
|
+
async postImage(channel_id, message) {
|
|
143
|
+
const formdata = await this.createFrom(message.image, message.msg_id, message.content, message.name);
|
|
144
|
+
const dary = formdata != false ? formdata.getBoundary() : '';
|
|
145
|
+
return this.request({
|
|
146
|
+
method: 'post',
|
|
147
|
+
url: `/channels/${channel_id}/messages`,
|
|
148
|
+
headers: {
|
|
149
|
+
'Content-Type': `multipart/form-data; boundary=${dary}`
|
|
150
|
+
},
|
|
151
|
+
data: formdata
|
|
152
|
+
}).then(res => res?.data);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* ***********
|
|
156
|
+
* 应用程序角色连接元数据接口
|
|
157
|
+
* **********
|
|
158
|
+
*/
|
|
159
|
+
/**
|
|
160
|
+
*
|
|
161
|
+
* 获取应用程序角色连接元数据记录
|
|
162
|
+
*/
|
|
163
|
+
async applicationRoleConnectionsMetadata(application_id) {
|
|
164
|
+
return this.request({
|
|
165
|
+
method: 'get',
|
|
166
|
+
url: `/applications/${application_id}/role-connections/metadata`
|
|
167
|
+
}).then(res => res?.data);
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
*
|
|
171
|
+
* 更新应用程序角色连接元数据记录
|
|
172
|
+
*/
|
|
173
|
+
async applicationRoleConnectionsMetadataUpdate(application_id) {
|
|
174
|
+
return this.request({
|
|
175
|
+
method: 'put',
|
|
176
|
+
url: `/applications/${application_id}/role-connections/metadata`
|
|
177
|
+
}).then(res => res?.data);
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* ********
|
|
181
|
+
* 用户api
|
|
182
|
+
* *******
|
|
183
|
+
*/
|
|
184
|
+
/**
|
|
185
|
+
* 获取当前用户详情
|
|
186
|
+
* @param message
|
|
187
|
+
* @returns
|
|
188
|
+
*/
|
|
189
|
+
async usersMe() {
|
|
190
|
+
return this.request({
|
|
191
|
+
method: 'get',
|
|
192
|
+
url: `/users/@me`
|
|
193
|
+
}).then(res => res?.data);
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* 根据id获取用户详情
|
|
197
|
+
* @param message
|
|
198
|
+
* @returns
|
|
199
|
+
*/
|
|
200
|
+
async userMessage(user_id) {
|
|
201
|
+
return this.request({
|
|
202
|
+
method: 'get',
|
|
203
|
+
url: `/users/${user_id}`
|
|
204
|
+
}).then(res => res?.data);
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* 获取当前用户频道
|
|
208
|
+
* @param params :{获取该频道 ID 之前的频道,获取该频道ID后的频道,返回的最大频道数量 (1-200),在响应中包括大概的成员和存在计数 }
|
|
209
|
+
* @returns
|
|
210
|
+
*/
|
|
211
|
+
async usersMeGuilds(params) {
|
|
212
|
+
return this.request({
|
|
213
|
+
method: 'get',
|
|
214
|
+
url: `/users/@me/guilds`,
|
|
215
|
+
params
|
|
216
|
+
}).then(res => res?.data);
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* *********
|
|
220
|
+
* 获取当前用户频道成员
|
|
221
|
+
* *********
|
|
222
|
+
*/
|
|
223
|
+
async usersMeGuildsMember(guild_id) {
|
|
224
|
+
return this.request({
|
|
225
|
+
method: 'get',
|
|
226
|
+
url: `/users/@me/guilds/${guild_id}/member`
|
|
227
|
+
}).then(res => res?.data);
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* *********
|
|
231
|
+
* 获取频道成员
|
|
232
|
+
* *********
|
|
233
|
+
*/
|
|
234
|
+
async guildsMember(guild_id) {
|
|
235
|
+
return this.request({
|
|
236
|
+
method: 'get',
|
|
237
|
+
url: `/guilds/${guild_id}/member`
|
|
238
|
+
}).then(res => res?.data);
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* *********
|
|
242
|
+
* 离开频道
|
|
243
|
+
* *********
|
|
244
|
+
*/
|
|
245
|
+
async usersMeGuildsDelete(guild_id) {
|
|
246
|
+
return this.request({
|
|
247
|
+
method: 'DELETE',
|
|
248
|
+
url: `/users/@me/guilds/${guild_id}`
|
|
249
|
+
}).then(res => res?.data);
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* *********
|
|
253
|
+
* 创建DM
|
|
254
|
+
* *********
|
|
255
|
+
*/
|
|
256
|
+
async userMeChannels() {
|
|
257
|
+
return this.request({
|
|
258
|
+
method: 'post',
|
|
259
|
+
url: `/user/@me/channels`
|
|
260
|
+
}).then(res => res?.data);
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* ********
|
|
264
|
+
* 应用api
|
|
265
|
+
* *******
|
|
266
|
+
*/
|
|
267
|
+
/**
|
|
268
|
+
* *********
|
|
269
|
+
* 获取当前应用程序
|
|
270
|
+
* *********
|
|
271
|
+
*/
|
|
272
|
+
async applicationsMe() {
|
|
273
|
+
return this.request({
|
|
274
|
+
method: 'GET',
|
|
275
|
+
url: `/applications/@me`
|
|
276
|
+
}).then(res => res?.data);
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* *********
|
|
280
|
+
* 编辑当前应用程序
|
|
281
|
+
* *********
|
|
282
|
+
*/
|
|
283
|
+
async applicationsMeUpdate() {
|
|
284
|
+
return this.request({
|
|
285
|
+
method: 'PATCH',
|
|
286
|
+
url: `/applications/@me`
|
|
287
|
+
}).then(res => res?.data);
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* *********
|
|
291
|
+
* 获取当前用户连接
|
|
292
|
+
* *********
|
|
293
|
+
*/
|
|
294
|
+
async usersMeConnections() {
|
|
295
|
+
return this.request({
|
|
296
|
+
method: 'GET',
|
|
297
|
+
url: `/users/@me/connections`
|
|
298
|
+
}).then(res => res?.data);
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* *********
|
|
302
|
+
* 获取当前用户应用程序角色连接
|
|
303
|
+
* *********
|
|
304
|
+
*/
|
|
305
|
+
async usersMeApplicationsRoleConnection(application_id) {
|
|
306
|
+
return this.request({
|
|
307
|
+
method: 'GET',
|
|
308
|
+
url: `/users/@me/applications/${application_id}/role-connection`
|
|
309
|
+
}).then(res => res?.data);
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* *********
|
|
313
|
+
* 更新当前用户应用程序角色连接
|
|
314
|
+
* *********
|
|
315
|
+
*/
|
|
316
|
+
async usersMeApplicationsRoleConnectionUpdate(application_id) {
|
|
317
|
+
return this.request({
|
|
318
|
+
method: 'PUT',
|
|
319
|
+
url: `/users/@me/applications/${application_id}/role-connection`
|
|
320
|
+
}).then(res => res?.data);
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* **********
|
|
324
|
+
* 频道api
|
|
325
|
+
* **********
|
|
326
|
+
*/
|
|
327
|
+
/**
|
|
328
|
+
* *********
|
|
329
|
+
* 创建频道
|
|
330
|
+
* *********
|
|
331
|
+
*/
|
|
332
|
+
async guildsCreate() {
|
|
333
|
+
return this.request({
|
|
334
|
+
method: 'post',
|
|
335
|
+
url: `/guilds`
|
|
336
|
+
}).then(res => res?.data);
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* *********
|
|
340
|
+
* 获取频道
|
|
341
|
+
* *********
|
|
342
|
+
*/
|
|
343
|
+
async guild(guild_id) {
|
|
344
|
+
return this.request({
|
|
345
|
+
method: 'get',
|
|
346
|
+
url: `/guilds/${guild_id}`
|
|
347
|
+
}).then(res => res?.data);
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* *********
|
|
351
|
+
* 获取频道预览
|
|
352
|
+
* *********
|
|
353
|
+
*/
|
|
354
|
+
async guildsPreview(guild_id) {
|
|
355
|
+
return this.request({
|
|
356
|
+
method: 'get',
|
|
357
|
+
url: `/guilds/${guild_id}/preview`
|
|
358
|
+
}).then(res => res?.data);
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* *********
|
|
362
|
+
* 修改频道
|
|
363
|
+
* *********
|
|
364
|
+
*/
|
|
365
|
+
async guildsUpdate(guild_id) {
|
|
366
|
+
return this.request({
|
|
367
|
+
method: 'PATCH',
|
|
368
|
+
url: `/guilds/${guild_id}`
|
|
369
|
+
}).then(res => res?.data);
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* *********
|
|
373
|
+
* 删除频道
|
|
374
|
+
* *********
|
|
375
|
+
*/
|
|
376
|
+
async guildsDelete(guild_id) {
|
|
377
|
+
return this.request({
|
|
378
|
+
method: 'DELETE',
|
|
379
|
+
url: `/guilds/${guild_id}`
|
|
380
|
+
}).then(res => res?.data);
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* *********
|
|
384
|
+
* 列出活跃的频道线程
|
|
385
|
+
* *********
|
|
386
|
+
*/
|
|
387
|
+
async guildsThreadsActive(guild_id) {
|
|
388
|
+
return this.request({
|
|
389
|
+
method: 'get',
|
|
390
|
+
url: `/guilds/${guild_id}/threads/active`
|
|
391
|
+
}).then(res => res?.data);
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* *********
|
|
395
|
+
* 获取频道成员消息
|
|
396
|
+
* *********
|
|
397
|
+
*/
|
|
398
|
+
async getGuildMember(guild_id, user_id) {
|
|
399
|
+
return this.request({
|
|
400
|
+
method: 'get',
|
|
401
|
+
url: `/guilds/${guild_id}/members/${user_id}`
|
|
402
|
+
}).then(res => res?.data);
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* *********
|
|
406
|
+
* 列出频道成员
|
|
407
|
+
* *********
|
|
408
|
+
*/
|
|
409
|
+
async guildsMembers(guild_id) {
|
|
410
|
+
return this.request({
|
|
411
|
+
method: 'get',
|
|
412
|
+
url: `/guilds/${guild_id}/members`
|
|
413
|
+
}).then(res => res?.data);
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* *********
|
|
417
|
+
* 搜索频道成员
|
|
418
|
+
* *********
|
|
419
|
+
*/
|
|
420
|
+
async guildsMembersSearch(guild_id) {
|
|
421
|
+
return this.request({
|
|
422
|
+
method: 'get',
|
|
423
|
+
url: `/guilds/${guild_id}/members/search`
|
|
424
|
+
}).then(res => res?.data);
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* *********
|
|
428
|
+
* 添加频道成员
|
|
429
|
+
* *********
|
|
430
|
+
*/
|
|
431
|
+
async guildsMembersAdd(guild_id, user_id) {
|
|
432
|
+
return this.request({
|
|
433
|
+
method: 'put',
|
|
434
|
+
url: `/guilds/${guild_id}/members/${user_id}`
|
|
435
|
+
}).then(res => res?.data);
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* *********
|
|
439
|
+
* 修改频道成员
|
|
440
|
+
* *********
|
|
441
|
+
*/
|
|
442
|
+
async guildsMembersUpdate(guild_id, user_id) {
|
|
443
|
+
return this.request({
|
|
444
|
+
method: 'PATCH',
|
|
445
|
+
url: `/guilds/${guild_id}/members/${user_id}`
|
|
446
|
+
}).then(res => res?.data);
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* *********
|
|
450
|
+
* 修改当前成员
|
|
451
|
+
* *********
|
|
452
|
+
*/
|
|
453
|
+
async guildsMembersMeNick(guild_id) {
|
|
454
|
+
return this.request({
|
|
455
|
+
method: 'PATCH',
|
|
456
|
+
url: `/guilds/${guild_id}/members/@me/nick`
|
|
457
|
+
}).then(res => res?.data);
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* *********
|
|
461
|
+
* 修改当前用户昵称
|
|
462
|
+
* *********
|
|
463
|
+
*/
|
|
464
|
+
async guildsMembersMeNickUpdate(guild_id) {
|
|
465
|
+
return this.request({
|
|
466
|
+
method: 'PATCH',
|
|
467
|
+
url: `/guilds/${guild_id}/members/@me/nick`
|
|
468
|
+
}).then(res => res?.data);
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* *********
|
|
472
|
+
* 获取频道角色
|
|
473
|
+
* *********
|
|
474
|
+
*/
|
|
475
|
+
async guildsRoles(guild_id) {
|
|
476
|
+
return this.request({
|
|
477
|
+
method: 'get',
|
|
478
|
+
url: `/guilds/${guild_id}/roles`
|
|
479
|
+
}).then(res => res?.data);
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* *********
|
|
483
|
+
* 创建频道角色
|
|
484
|
+
* *********
|
|
485
|
+
*/
|
|
486
|
+
async guildsRolesCreate(guild_id) {
|
|
487
|
+
return this.request({
|
|
488
|
+
method: 'post',
|
|
489
|
+
url: `/guilds/${guild_id}/roles`
|
|
490
|
+
}).then(res => res?.data);
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* *********
|
|
494
|
+
* 修改频道角色位置
|
|
495
|
+
* *********
|
|
496
|
+
*/
|
|
497
|
+
async guildsRolesUpdate(guild_id) {
|
|
498
|
+
return this.request({
|
|
499
|
+
method: 'PATCH',
|
|
500
|
+
url: `/guilds/${guild_id}/roles`
|
|
501
|
+
}).then(res => res?.data);
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* *********
|
|
505
|
+
* 修改频道角色
|
|
506
|
+
* *********
|
|
507
|
+
*/
|
|
508
|
+
async guildsRolesUpdateById(guild_id, role_id) {
|
|
509
|
+
return this.request({
|
|
510
|
+
method: 'PATCH',
|
|
511
|
+
url: `/guilds/${guild_id}/roles/${role_id}`
|
|
512
|
+
}).then(res => res?.data);
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* *********
|
|
516
|
+
* 添加频道成员角色
|
|
517
|
+
* *********
|
|
518
|
+
*/
|
|
519
|
+
async guildsMEmbersRolesAdd(guild_id, user_id, role_id) {
|
|
520
|
+
return this.request({
|
|
521
|
+
method: 'put',
|
|
522
|
+
url: `/guilds/${guild_id}/members/${user_id}/roles/${role_id}`
|
|
523
|
+
}).then(res => res?.data);
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* *********
|
|
527
|
+
* 删除频道成员角色
|
|
528
|
+
* *********
|
|
529
|
+
*/
|
|
530
|
+
async guildsMembersRolesDelete(guild_id, user_id, role_id) {
|
|
531
|
+
return this.request({
|
|
532
|
+
method: 'DELETE',
|
|
533
|
+
url: `/guilds/${guild_id}/members/${user_id}/roles/${role_id}`
|
|
534
|
+
}).then(res => res?.data);
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* *********
|
|
538
|
+
* 删除频道角色
|
|
539
|
+
* *********
|
|
540
|
+
*/
|
|
541
|
+
async guildsRolesDelete(guild_id, role_id) {
|
|
542
|
+
return this.request({
|
|
543
|
+
method: 'DELETE',
|
|
544
|
+
url: `/guilds/${guild_id}/roles/${role_id}`
|
|
545
|
+
}).then(res => res?.data);
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* *********
|
|
549
|
+
* 删除频道成员
|
|
550
|
+
* *********
|
|
551
|
+
*/
|
|
552
|
+
async guildsMembersDelete(guild_id, user_id) {
|
|
553
|
+
return this.request({
|
|
554
|
+
method: 'DELETE',
|
|
555
|
+
url: `/guilds/${guild_id}/members/${user_id}`
|
|
556
|
+
}).then(res => res?.data);
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* *********
|
|
560
|
+
* 获取频道禁令
|
|
561
|
+
* *********
|
|
562
|
+
*/
|
|
563
|
+
async guildsBans(guild_id) {
|
|
564
|
+
return this.request({
|
|
565
|
+
method: 'get',
|
|
566
|
+
url: `/guilds/${guild_id}/bans`
|
|
567
|
+
}).then(res => res?.data);
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* *********
|
|
571
|
+
* 获得频道禁令
|
|
572
|
+
* *********
|
|
573
|
+
*/
|
|
574
|
+
async guildsBansDelete(guild_id, user_id) {
|
|
575
|
+
return this.request({
|
|
576
|
+
method: 'DELETE',
|
|
577
|
+
url: `/guilds/${guild_id}/bans/${user_id}`
|
|
578
|
+
}).then(res => res?.data);
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* *********
|
|
582
|
+
* 创建频道禁令
|
|
583
|
+
* *********
|
|
584
|
+
*/
|
|
585
|
+
async guildsBansCreateByUserId(guild_id, user_id) {
|
|
586
|
+
return this.request({
|
|
587
|
+
method: 'PUT',
|
|
588
|
+
url: `/guilds/${guild_id}/bans/${user_id}`
|
|
589
|
+
}).then(res => res?.data);
|
|
590
|
+
}
|
|
591
|
+
/**
|
|
592
|
+
* *********
|
|
593
|
+
* 解除频道禁令
|
|
594
|
+
* *********
|
|
595
|
+
*/
|
|
596
|
+
async guildsBansDeleteByUserId(guild_id, user_id) {
|
|
597
|
+
return this.request({
|
|
598
|
+
method: 'DELETE',
|
|
599
|
+
url: `/guilds/${guild_id}/bans/${user_id}`
|
|
600
|
+
}).then(res => res?.data);
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* *********
|
|
604
|
+
* 修改频道MFA级别
|
|
605
|
+
* *********
|
|
606
|
+
*/
|
|
607
|
+
async guildsMfa(guild_id) {
|
|
608
|
+
return this.request({
|
|
609
|
+
method: 'post',
|
|
610
|
+
url: `/guilds/${guild_id}/mfa`
|
|
611
|
+
}).then(res => res?.data);
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* *********
|
|
615
|
+
* 获取频道修剪数量
|
|
616
|
+
* *********
|
|
617
|
+
*/
|
|
618
|
+
async guildsPrune(guild_id) {
|
|
619
|
+
return this.request({
|
|
620
|
+
method: 'get',
|
|
621
|
+
url: `/guilds/${guild_id}/prune`
|
|
622
|
+
}).then(res => res?.data);
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* *********
|
|
626
|
+
* 开始频道修剪
|
|
627
|
+
* *********
|
|
628
|
+
*/
|
|
629
|
+
async guildsPruneUpdate(guild_id) {
|
|
630
|
+
return this.request({
|
|
631
|
+
method: 'post',
|
|
632
|
+
url: `/guilds/${guild_id}/prune`
|
|
633
|
+
}).then(res => res?.data);
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* *********
|
|
637
|
+
* 获取频道邀请
|
|
638
|
+
* *********
|
|
639
|
+
*/
|
|
640
|
+
async guildsInvites(guild_id) {
|
|
641
|
+
return this.request({
|
|
642
|
+
method: 'get',
|
|
643
|
+
url: `/guilds/${guild_id}/invites`
|
|
644
|
+
}).then(res => res?.data);
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* *********
|
|
648
|
+
* 获取频道集成
|
|
649
|
+
* *********
|
|
650
|
+
*/
|
|
651
|
+
async guildsIntegrations(guild_id) {
|
|
652
|
+
return this.request({
|
|
653
|
+
method: 'get',
|
|
654
|
+
url: `/guilds/${guild_id}/integrations`
|
|
655
|
+
}).then(res => res?.data);
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* *********
|
|
659
|
+
* 删除频道集成
|
|
660
|
+
* *********
|
|
661
|
+
*/
|
|
662
|
+
async guildsDeleteByIntegrationsId(guild_id, integration_id) {
|
|
663
|
+
return this.request({
|
|
664
|
+
method: 'DELETE',
|
|
665
|
+
url: `/guilds/${guild_id}/${integration_id}`
|
|
666
|
+
}).then(res => res?.data);
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* *********
|
|
670
|
+
* 获取频道小部件设置
|
|
671
|
+
* *********
|
|
672
|
+
*/
|
|
673
|
+
async guildsWidget(guild_id) {
|
|
674
|
+
return this.request({
|
|
675
|
+
method: 'get',
|
|
676
|
+
url: `/guilds/${guild_id}/widget`
|
|
677
|
+
}).then(res => res?.data);
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* *********
|
|
681
|
+
* 修改频道小部件
|
|
682
|
+
* *********
|
|
683
|
+
*/
|
|
684
|
+
async guildsWidgetUpdate(guild_id) {
|
|
685
|
+
return this.request({
|
|
686
|
+
method: 'PATCH',
|
|
687
|
+
url: `/guilds/${guild_id}/widget`
|
|
688
|
+
}).then(res => res?.data);
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* *********
|
|
692
|
+
* 获取频道小部件
|
|
693
|
+
* *********
|
|
694
|
+
*/
|
|
695
|
+
async guildsWidgetJSON(guild_id) {
|
|
696
|
+
return this.request({
|
|
697
|
+
method: 'get',
|
|
698
|
+
url: `/guilds/${guild_id}/widget.json`
|
|
699
|
+
}).then(res => res?.data);
|
|
700
|
+
}
|
|
701
|
+
/**
|
|
702
|
+
* *********
|
|
703
|
+
* 获取频道个性网址
|
|
704
|
+
* *********
|
|
705
|
+
*/
|
|
706
|
+
async guildVanityUrl(guild_id) {
|
|
707
|
+
return this.request({
|
|
708
|
+
method: 'get',
|
|
709
|
+
url: `/guilds/${guild_id}/vanity-url`
|
|
710
|
+
}).then(res => res?.data);
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* *********
|
|
714
|
+
* 获取频道小部件图像
|
|
715
|
+
* *********
|
|
716
|
+
*/
|
|
717
|
+
async guildsWidgetPNG(guild_id) {
|
|
718
|
+
return this.request({
|
|
719
|
+
method: 'get',
|
|
720
|
+
url: `/guilds/${guild_id}/widget.png`
|
|
721
|
+
}).then(res => res?.data);
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* *********
|
|
725
|
+
* 获取频道欢迎屏幕
|
|
726
|
+
* *********
|
|
727
|
+
*/
|
|
728
|
+
async guildsWelconScreen(guild_id) {
|
|
729
|
+
return this.request({
|
|
730
|
+
method: 'get',
|
|
731
|
+
url: `/guilds/${guild_id}/welcome-screen`
|
|
732
|
+
}).then(res => res?.data);
|
|
733
|
+
}
|
|
734
|
+
/**
|
|
735
|
+
* *********
|
|
736
|
+
* 修改频道欢迎界面
|
|
737
|
+
* *********
|
|
738
|
+
*/
|
|
739
|
+
async guildsWelconmeScreen(guild_id) {
|
|
740
|
+
return this.request({
|
|
741
|
+
method: 'PATCH',
|
|
742
|
+
url: `/guilds/${guild_id}/welcome-screen`
|
|
743
|
+
}).then(res => res?.data);
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* *********
|
|
747
|
+
* 获取频道入职
|
|
748
|
+
* *********
|
|
749
|
+
*/
|
|
750
|
+
async guildsOnboarding(guild_id) {
|
|
751
|
+
return this.request({
|
|
752
|
+
method: 'get',
|
|
753
|
+
url: `/guilds/${guild_id}/onboarding`
|
|
754
|
+
}).then(res => res?.data);
|
|
755
|
+
}
|
|
756
|
+
/**
|
|
757
|
+
* *********
|
|
758
|
+
* 修改频道入职
|
|
759
|
+
* *********
|
|
760
|
+
*/
|
|
761
|
+
async guildsOnboardingUpdate(guild_id) {
|
|
762
|
+
return this.request({
|
|
763
|
+
method: 'PUT',
|
|
764
|
+
url: `/guilds/${guild_id}/onboarding`
|
|
765
|
+
}).then(res => res?.data);
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* *********
|
|
769
|
+
* 获取公会审核日志
|
|
770
|
+
* *********
|
|
771
|
+
*/
|
|
772
|
+
async guildsAuditLogs(guild_id) {
|
|
773
|
+
return this.request({
|
|
774
|
+
method: 'get',
|
|
775
|
+
url: `/guilds/${guild_id}/audit-logs`
|
|
776
|
+
}).then(res => res?.data);
|
|
777
|
+
}
|
|
778
|
+
/**
|
|
779
|
+
* *********
|
|
780
|
+
* 获取自动审核规则
|
|
781
|
+
* *********
|
|
782
|
+
*/
|
|
783
|
+
async guildsAutoModerationsRules(guild_id, auto_moderation_rule_id) {
|
|
784
|
+
return this.request({
|
|
785
|
+
method: 'get',
|
|
786
|
+
url: `/guilds/${guild_id}/auto-moderation/rules/${auto_moderation_rule_id}`
|
|
787
|
+
}).then(res => res?.data);
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
790
|
+
* *********
|
|
791
|
+
* 创建自动审核规则
|
|
792
|
+
* *********
|
|
793
|
+
*/
|
|
794
|
+
async guildsAutoModerationRulesCreate(guild_id) {
|
|
795
|
+
return this.request({
|
|
796
|
+
method: 'POST',
|
|
797
|
+
url: `/guilds/${guild_id}/auto-moderation/rules`
|
|
798
|
+
}).then(res => res?.data);
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
* *********
|
|
802
|
+
* 修改自动审核规则
|
|
803
|
+
* *********
|
|
804
|
+
*/
|
|
805
|
+
async guildsAutoModerationsRulesUpdate(guild_id, auto_moderation_rule_id) {
|
|
806
|
+
return this.request({
|
|
807
|
+
method: 'PATCH',
|
|
808
|
+
url: `/guilds/${guild_id}/auto-moderation/rules/${auto_moderation_rule_id}`
|
|
809
|
+
}).then(res => res?.data);
|
|
810
|
+
}
|
|
811
|
+
/**
|
|
812
|
+
* *********
|
|
813
|
+
* 删除自动审核规则
|
|
814
|
+
* *********
|
|
815
|
+
*/
|
|
816
|
+
async guildsAutoModerationsRulesDelete(guild_id, auto_moderation_rule_id) {
|
|
817
|
+
return this.request({
|
|
818
|
+
method: 'DELETE',
|
|
819
|
+
url: `/guilds/${guild_id}/auto-moderation/rules/${auto_moderation_rule_id}`
|
|
820
|
+
}).then(res => res?.data);
|
|
821
|
+
}
|
|
822
|
+
/**
|
|
823
|
+
* ************
|
|
824
|
+
* 子频道api
|
|
825
|
+
* ***********
|
|
826
|
+
*/
|
|
827
|
+
/**
|
|
828
|
+
* *********
|
|
829
|
+
* 获取所有子频道
|
|
830
|
+
* *********
|
|
831
|
+
*/
|
|
832
|
+
async guildsanyChannels(guild_id) {
|
|
833
|
+
return this.request({
|
|
834
|
+
method: 'get',
|
|
835
|
+
url: `/guilds/${guild_id}/channels`
|
|
836
|
+
}).then(res => res?.data);
|
|
837
|
+
}
|
|
838
|
+
/**
|
|
839
|
+
* *********
|
|
840
|
+
* 获取子频道
|
|
841
|
+
* *********
|
|
842
|
+
*/
|
|
843
|
+
async guildsChannels(channel_id) {
|
|
844
|
+
return this.request({
|
|
845
|
+
method: 'get',
|
|
846
|
+
url: `/channels/${channel_id}`
|
|
847
|
+
}).then(res => res?.data);
|
|
848
|
+
}
|
|
849
|
+
/**
|
|
850
|
+
* *********
|
|
851
|
+
* 修改子频道
|
|
852
|
+
* *********
|
|
853
|
+
*/
|
|
854
|
+
async guildsChannelsUpdate(channel_id) {
|
|
855
|
+
return this.request({
|
|
856
|
+
method: 'PATCH',
|
|
857
|
+
url: `/channels/${channel_id}`
|
|
858
|
+
}).then(res => res?.data);
|
|
859
|
+
}
|
|
860
|
+
/**
|
|
861
|
+
* *********
|
|
862
|
+
* 删除子频道
|
|
863
|
+
* *********
|
|
864
|
+
*/
|
|
865
|
+
async guildsChannelsDELETE(channel_id) {
|
|
866
|
+
return this.request({
|
|
867
|
+
method: 'DELETE',
|
|
868
|
+
url: `/channels/${channel_id}`
|
|
869
|
+
}).then(res => res?.data);
|
|
870
|
+
}
|
|
871
|
+
/**
|
|
872
|
+
* *********
|
|
873
|
+
* 创建子频道
|
|
874
|
+
* *********
|
|
875
|
+
*/
|
|
876
|
+
async guildsChannelsCreate(guild_id) {
|
|
877
|
+
return this.request({
|
|
878
|
+
method: 'post',
|
|
879
|
+
url: `/guilds/${guild_id}/channels`
|
|
880
|
+
}).then(res => res?.data);
|
|
881
|
+
}
|
|
882
|
+
/**
|
|
883
|
+
* *********
|
|
884
|
+
* 修改子频道位置
|
|
885
|
+
* *********
|
|
886
|
+
*/
|
|
887
|
+
async guildsChannelsUpdateposi(guild_id) {
|
|
888
|
+
return this.request({
|
|
889
|
+
method: 'PATCH',
|
|
890
|
+
url: `/guilds/${guild_id}/channels`
|
|
891
|
+
}).then(res => res?.data);
|
|
892
|
+
}
|
|
893
|
+
/**
|
|
894
|
+
* *********
|
|
895
|
+
* 获取频道邀请
|
|
896
|
+
* *********
|
|
897
|
+
*/
|
|
898
|
+
async getChannelInvites(channel_id) {
|
|
899
|
+
return this.request({
|
|
900
|
+
method: 'get',
|
|
901
|
+
url: `/channels/ ${channel_id} /invites`
|
|
902
|
+
}).then(res => res?.data);
|
|
903
|
+
}
|
|
904
|
+
/**
|
|
905
|
+
* *********
|
|
906
|
+
* 创建频道邀请
|
|
907
|
+
* *********
|
|
908
|
+
*/
|
|
909
|
+
async createChannelInvites(channel_id) {
|
|
910
|
+
return this.request({
|
|
911
|
+
method: 'POST',
|
|
912
|
+
url: `/channels/ ${channel_id} /invites`
|
|
913
|
+
}).then(res => res?.data);
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* *********
|
|
917
|
+
* 删除频道邀请
|
|
918
|
+
* *********
|
|
919
|
+
*/
|
|
920
|
+
async deleteChannelInvites(channel_id) {
|
|
921
|
+
return this.request({
|
|
922
|
+
method: 'POST',
|
|
923
|
+
url: `/channels/ ${channel_id} /invites`
|
|
924
|
+
}).then(res => res?.data);
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* *********
|
|
928
|
+
*触发输入指示器
|
|
929
|
+
* *********
|
|
930
|
+
*/
|
|
931
|
+
async triggerTypingIndicator(channel_id) {
|
|
932
|
+
return this.request({
|
|
933
|
+
method: 'POST',
|
|
934
|
+
url: `/channels/ ${channel_id} /typing`
|
|
935
|
+
}).then(res => res?.data);
|
|
936
|
+
}
|
|
937
|
+
/**
|
|
938
|
+
* *********
|
|
939
|
+
*群组 DM 添加收件人
|
|
940
|
+
* *********
|
|
941
|
+
*/
|
|
942
|
+
async groupDMAddRecipient(channel_id, user_id) {
|
|
943
|
+
return this.request({
|
|
944
|
+
method: 'put',
|
|
945
|
+
url: `/channels/ ${channel_id} /recipients/${user_id}`
|
|
946
|
+
}).then(res => res?.data);
|
|
947
|
+
}
|
|
948
|
+
/**
|
|
949
|
+
* *********
|
|
950
|
+
*群组DM删除收件人
|
|
951
|
+
* *********
|
|
952
|
+
*/
|
|
953
|
+
async groupDMdeleteRecipient(channel_id, user_id) {
|
|
954
|
+
return this.request({
|
|
955
|
+
method: 'delete',
|
|
956
|
+
url: `/channels/ ${channel_id} /recipients/${user_id}`
|
|
957
|
+
}).then(res => res?.data);
|
|
958
|
+
}
|
|
959
|
+
/**
|
|
960
|
+
* *********
|
|
961
|
+
*启动消息开始线程
|
|
962
|
+
* *********
|
|
963
|
+
*/
|
|
964
|
+
async startThreadfromMessage(channel_id, message_id) {
|
|
965
|
+
return this.request({
|
|
966
|
+
method: 'post',
|
|
967
|
+
url: `/channels/${channel_id} /messages/${message_id} /threads`
|
|
968
|
+
}).then(res => res?.data);
|
|
969
|
+
}
|
|
970
|
+
/**
|
|
971
|
+
* *********
|
|
972
|
+
*启动没有消息的线程
|
|
973
|
+
* *********
|
|
974
|
+
*/
|
|
975
|
+
async startThreadwithoutMessag(channel_id) {
|
|
976
|
+
return this.request({
|
|
977
|
+
method: 'post',
|
|
978
|
+
url: `/channels/${channel_id}/threads`
|
|
979
|
+
}).then(res => res?.data);
|
|
980
|
+
}
|
|
981
|
+
/**
|
|
982
|
+
* *********
|
|
983
|
+
*在论坛或媒体频道中启动话题
|
|
984
|
+
* *********
|
|
985
|
+
*/
|
|
986
|
+
async startThreadinForum(channel_id) {
|
|
987
|
+
return this.request({
|
|
988
|
+
method: 'post',
|
|
989
|
+
url: `/channels/${channel_id}/threads`
|
|
990
|
+
}).then(res => res?.data);
|
|
991
|
+
}
|
|
992
|
+
/**
|
|
993
|
+
* *********
|
|
994
|
+
*加入话题
|
|
995
|
+
* *********
|
|
996
|
+
*/
|
|
997
|
+
async joinThread(channel_id) {
|
|
998
|
+
return this.request({
|
|
999
|
+
method: 'PUT',
|
|
1000
|
+
url: `/channels/${channel_id}/thread-members/@me`
|
|
1001
|
+
}).then(res => res?.data);
|
|
1002
|
+
}
|
|
1003
|
+
/**
|
|
1004
|
+
* *********
|
|
1005
|
+
*添加话题成员
|
|
1006
|
+
* *********
|
|
1007
|
+
*/
|
|
1008
|
+
async addThreadMember(channel_id, user_id) {
|
|
1009
|
+
return this.request({
|
|
1010
|
+
method: 'PUT',
|
|
1011
|
+
url: `/channels/${channel_id}/thread-members/${user_id}`
|
|
1012
|
+
}).then(res => res?.data);
|
|
1013
|
+
}
|
|
1014
|
+
/**
|
|
1015
|
+
* *********
|
|
1016
|
+
*删除话题
|
|
1017
|
+
* *********
|
|
1018
|
+
*/
|
|
1019
|
+
async leavethread(channel_id) {
|
|
1020
|
+
return this.request({
|
|
1021
|
+
method: 'delete',
|
|
1022
|
+
url: `/channels/${channel_id}/thread-members/@me`
|
|
1023
|
+
}).then(res => res?.data);
|
|
1024
|
+
}
|
|
1025
|
+
/**
|
|
1026
|
+
* *********
|
|
1027
|
+
*删除线程成员
|
|
1028
|
+
* *********
|
|
1029
|
+
*/
|
|
1030
|
+
async removeThreadMember(channel_id, user_id) {
|
|
1031
|
+
return this.request({
|
|
1032
|
+
method: 'delete',
|
|
1033
|
+
url: `/channels/${channel_id}/thread-members/${user_id}`
|
|
1034
|
+
}).then(res => res?.data);
|
|
1035
|
+
}
|
|
1036
|
+
/**
|
|
1037
|
+
* *********
|
|
1038
|
+
*获取线程成员
|
|
1039
|
+
* *********
|
|
1040
|
+
*/
|
|
1041
|
+
async getThreadMember(channel_id, user_id) {
|
|
1042
|
+
return this.request({
|
|
1043
|
+
method: 'get',
|
|
1044
|
+
url: `/channels/${channel_id}/thread-members/${user_id}`
|
|
1045
|
+
}).then(res => res?.data);
|
|
1046
|
+
}
|
|
1047
|
+
/**
|
|
1048
|
+
* *********
|
|
1049
|
+
*列出线程成员
|
|
1050
|
+
* *********
|
|
1051
|
+
*/
|
|
1052
|
+
async listThreadMembers(channel_id) {
|
|
1053
|
+
return this.request({
|
|
1054
|
+
method: 'get',
|
|
1055
|
+
url: `/channels/${channel_id}/thread-members`
|
|
1056
|
+
}).then(res => res?.data);
|
|
1057
|
+
}
|
|
1058
|
+
/**
|
|
1059
|
+
* *********
|
|
1060
|
+
*列出公共存档主题
|
|
1061
|
+
* *********
|
|
1062
|
+
*/
|
|
1063
|
+
async listPublicArchivedThread(channel_id) {
|
|
1064
|
+
return this.request({
|
|
1065
|
+
method: 'get',
|
|
1066
|
+
url: `/channels/${channel_id}/threads/archived/public`
|
|
1067
|
+
}).then(res => res?.data);
|
|
1068
|
+
}
|
|
1069
|
+
/**
|
|
1070
|
+
* *********
|
|
1071
|
+
*列出私有存档线程
|
|
1072
|
+
* *********
|
|
1073
|
+
*/
|
|
1074
|
+
async listPrivateArchivedThreads(channel_id) {
|
|
1075
|
+
return this.request({
|
|
1076
|
+
method: 'get',
|
|
1077
|
+
url: `/channels/${channel_id}/threads/archived/private`
|
|
1078
|
+
}).then(res => res?.data);
|
|
1079
|
+
}
|
|
1080
|
+
/**
|
|
1081
|
+
* *********
|
|
1082
|
+
*列出已加入的私人存档主题
|
|
1083
|
+
* *********
|
|
1084
|
+
*/
|
|
1085
|
+
async listoinedPrivateThreads(channel_id) {
|
|
1086
|
+
return this.request({
|
|
1087
|
+
method: 'get',
|
|
1088
|
+
url: `/channels/${channel_id}/users/@me/threads/archived/private`
|
|
1089
|
+
}).then(res => res?.data);
|
|
1090
|
+
}
|
|
1091
|
+
/**
|
|
1092
|
+
* ***********
|
|
1093
|
+
* 频道身份api
|
|
1094
|
+
* ***********
|
|
1095
|
+
*/
|
|
1096
|
+
/**
|
|
1097
|
+
* **********
|
|
1098
|
+
* 子频道权限api
|
|
1099
|
+
* **********
|
|
1100
|
+
*/
|
|
1101
|
+
/**
|
|
1102
|
+
* *********
|
|
1103
|
+
* 编辑频道权限
|
|
1104
|
+
* *********
|
|
1105
|
+
*/
|
|
1106
|
+
async editChannelPermissions(channel_id, overwrite_id) {
|
|
1107
|
+
return this.request({
|
|
1108
|
+
method: 'PATCH',
|
|
1109
|
+
url: `/channels/ ${channel_id} /permissions/ ${overwrite_id}`
|
|
1110
|
+
}).then(res => res?.data);
|
|
1111
|
+
}
|
|
1112
|
+
/**
|
|
1113
|
+
* *********
|
|
1114
|
+
* 删除频道权限
|
|
1115
|
+
* *********
|
|
1116
|
+
*/
|
|
1117
|
+
async deleteChannelPermissions(channel_id, overwrite_id) {
|
|
1118
|
+
return this.request({
|
|
1119
|
+
method: 'delete',
|
|
1120
|
+
url: `/channels/ ${channel_id} /permissions/ ${overwrite_id}`
|
|
1121
|
+
}).then(res => res?.data);
|
|
1122
|
+
}
|
|
1123
|
+
/**
|
|
1124
|
+
* *******
|
|
1125
|
+
* 消息api
|
|
1126
|
+
* ********
|
|
1127
|
+
*/
|
|
1128
|
+
/**
|
|
1129
|
+
* *********
|
|
1130
|
+
* 获取子频道消息
|
|
1131
|
+
* *********
|
|
1132
|
+
*/
|
|
1133
|
+
async guildsChannelsanymessages(channel_id) {
|
|
1134
|
+
return this.request({
|
|
1135
|
+
method: 'get',
|
|
1136
|
+
url: `/channels/${channel_id}/messages`
|
|
1137
|
+
}).then(res => res?.data);
|
|
1138
|
+
}
|
|
1139
|
+
/**
|
|
1140
|
+
* *********
|
|
1141
|
+
* 获取单条子频道消息
|
|
1142
|
+
* *********
|
|
1143
|
+
*/
|
|
1144
|
+
async guildsChannelsmessages(channel_id, message_id) {
|
|
1145
|
+
return this.request({
|
|
1146
|
+
method: 'get',
|
|
1147
|
+
url: `/channels/${channel_id}/messages/${message_id}`
|
|
1148
|
+
}).then(res => res?.data);
|
|
1149
|
+
}
|
|
1150
|
+
/**
|
|
1151
|
+
* *********
|
|
1152
|
+
* 创建子频道消息
|
|
1153
|
+
* *********
|
|
1154
|
+
*/
|
|
1155
|
+
async guildsChannelscreatmess(channel_id) {
|
|
1156
|
+
return this.request({
|
|
1157
|
+
method: 'post',
|
|
1158
|
+
url: `/channels/${channel_id}/messages`
|
|
1159
|
+
}).then(res => res?.data);
|
|
1160
|
+
}
|
|
1161
|
+
/**
|
|
1162
|
+
* *********
|
|
1163
|
+
* 交叉发布消息
|
|
1164
|
+
* *********
|
|
1165
|
+
*/
|
|
1166
|
+
async crosspostmessages(channel_id, message_id) {
|
|
1167
|
+
return this.request({
|
|
1168
|
+
method: 'POST',
|
|
1169
|
+
url: `/channels/ ${channel_id} /messages/ ${message_id} /crosspost`
|
|
1170
|
+
}).then(res => res?.data);
|
|
1171
|
+
}
|
|
1172
|
+
/**
|
|
1173
|
+
* *********
|
|
1174
|
+
* 创造反应
|
|
1175
|
+
* *********
|
|
1176
|
+
*/
|
|
1177
|
+
async createareaction(channel_id, message_id, emoji) {
|
|
1178
|
+
return this.request({
|
|
1179
|
+
method: 'PUT',
|
|
1180
|
+
url: `/channels/ ${channel_id} /messages/ ${message_id} /reactions/${emoji}/@me`
|
|
1181
|
+
}).then(res => res?.data);
|
|
1182
|
+
}
|
|
1183
|
+
/**
|
|
1184
|
+
* *********
|
|
1185
|
+
* 删除自己的反应
|
|
1186
|
+
* *********
|
|
1187
|
+
*/
|
|
1188
|
+
async deleteownreaction(channel_id, message_id, emoji) {
|
|
1189
|
+
return this.request({
|
|
1190
|
+
method: 'DELETE',
|
|
1191
|
+
url: `/channels/ ${channel_id} /messages/ ${message_id} /reactions/${emoji}/@me`
|
|
1192
|
+
}).then(res => res?.data);
|
|
1193
|
+
}
|
|
1194
|
+
/**
|
|
1195
|
+
* *********
|
|
1196
|
+
* 删除别人的反应
|
|
1197
|
+
* *********
|
|
1198
|
+
*/
|
|
1199
|
+
async deleteareuserction(channel_id, message_id, emoji, user_id) {
|
|
1200
|
+
return this.request({
|
|
1201
|
+
method: 'DELETE',
|
|
1202
|
+
url: `/channels/ ${channel_id} /messages/ ${message_id} /reactions/${emoji}/${user_id}`
|
|
1203
|
+
}).then(res => res?.data);
|
|
1204
|
+
}
|
|
1205
|
+
/**
|
|
1206
|
+
* *********
|
|
1207
|
+
* 获取反应
|
|
1208
|
+
* *********
|
|
1209
|
+
*/
|
|
1210
|
+
async getownreaction(channel_id, message_id, emoji) {
|
|
1211
|
+
return this.request({
|
|
1212
|
+
method: 'get',
|
|
1213
|
+
url: `/channels/ ${channel_id} /messages/ ${message_id} /reactions/${emoji}`
|
|
1214
|
+
}).then(res => res?.data);
|
|
1215
|
+
}
|
|
1216
|
+
/**
|
|
1217
|
+
* *********
|
|
1218
|
+
* 删除所有反应
|
|
1219
|
+
* *********
|
|
1220
|
+
*/
|
|
1221
|
+
async deleteAllreaction(channel_id, message_id) {
|
|
1222
|
+
return this.request({
|
|
1223
|
+
method: 'DELETE',
|
|
1224
|
+
url: `/channels/ ${channel_id} /messages/ ${message_id} /reactions`
|
|
1225
|
+
}).then(res => res?.data);
|
|
1226
|
+
}
|
|
1227
|
+
/**
|
|
1228
|
+
* *********
|
|
1229
|
+
* 删除表情符号的所有反应
|
|
1230
|
+
* *********
|
|
1231
|
+
*/
|
|
1232
|
+
async deleteAllreactionforEmoji(channel_id, message_id, emoji) {
|
|
1233
|
+
return this.request({
|
|
1234
|
+
method: 'DELETE',
|
|
1235
|
+
url: `/channels/ ${channel_id} /messages/ ${message_id} /reactions/${emoji}`
|
|
1236
|
+
}).then(res => res?.data);
|
|
1237
|
+
}
|
|
1238
|
+
/**
|
|
1239
|
+
* *********
|
|
1240
|
+
* 编辑消息
|
|
1241
|
+
* *********
|
|
1242
|
+
*/
|
|
1243
|
+
async editMessage(channel_id, message_id) {
|
|
1244
|
+
return this.request({
|
|
1245
|
+
method: 'PATCH',
|
|
1246
|
+
url: `/channels/${channel_id}/messages/${message_id}`
|
|
1247
|
+
}).then(res => res?.data);
|
|
1248
|
+
}
|
|
1249
|
+
/**
|
|
1250
|
+
* *********
|
|
1251
|
+
* 撤回消息
|
|
1252
|
+
* *********
|
|
1253
|
+
*/
|
|
1254
|
+
async deleteMessage(channel_id, message_id) {
|
|
1255
|
+
return this.request({
|
|
1256
|
+
method: 'PATCH',
|
|
1257
|
+
url: `/channels/${channel_id}/messages/${message_id}`
|
|
1258
|
+
}).then(res => res?.data);
|
|
1259
|
+
}
|
|
1260
|
+
/**
|
|
1261
|
+
* *********
|
|
1262
|
+
* 批量删除消息
|
|
1263
|
+
* *********
|
|
1264
|
+
*/
|
|
1265
|
+
async bulkdeleteMessage(channel_id) {
|
|
1266
|
+
return this.request({
|
|
1267
|
+
method: 'post',
|
|
1268
|
+
url: `/channels/${channel_id}/messages/bulk-delete`
|
|
1269
|
+
}).then(res => res?.data);
|
|
1270
|
+
}
|
|
1271
|
+
/**
|
|
1272
|
+
* ************
|
|
1273
|
+
* 消息频率api
|
|
1274
|
+
* **********
|
|
1275
|
+
*/
|
|
1276
|
+
/**
|
|
1277
|
+
* ***********
|
|
1278
|
+
* 私信api
|
|
1279
|
+
* **********
|
|
1280
|
+
*/
|
|
1281
|
+
/**
|
|
1282
|
+
* *********
|
|
1283
|
+
* 禁言api
|
|
1284
|
+
* *******
|
|
1285
|
+
*/
|
|
1286
|
+
/**
|
|
1287
|
+
* *******
|
|
1288
|
+
* 公告api
|
|
1289
|
+
* *******
|
|
1290
|
+
*/
|
|
1291
|
+
/**
|
|
1292
|
+
* *********
|
|
1293
|
+
* 关注公告频道
|
|
1294
|
+
* *********
|
|
1295
|
+
*/
|
|
1296
|
+
async followAnnouncementChannel(channel_id) {
|
|
1297
|
+
return this.request({
|
|
1298
|
+
method: 'POST',
|
|
1299
|
+
url: `/channels/ ${channel_id} /followers`
|
|
1300
|
+
}).then(res => res?.data);
|
|
1301
|
+
}
|
|
1302
|
+
/**
|
|
1303
|
+
* **********
|
|
1304
|
+
* 精华消息api
|
|
1305
|
+
* **********
|
|
1306
|
+
*/
|
|
1307
|
+
/**
|
|
1308
|
+
* *********
|
|
1309
|
+
*获取置顶消息
|
|
1310
|
+
* *********
|
|
1311
|
+
*/
|
|
1312
|
+
async getPinnedMessages(channel_id) {
|
|
1313
|
+
return this.request({
|
|
1314
|
+
method: 'get',
|
|
1315
|
+
url: `/channels/ ${channel_id}/pins`
|
|
1316
|
+
}).then(res => res?.data);
|
|
1317
|
+
}
|
|
1318
|
+
/**
|
|
1319
|
+
* *********
|
|
1320
|
+
*置顶消息
|
|
1321
|
+
* *********
|
|
1322
|
+
*/
|
|
1323
|
+
async pinMessage(channel_id, message_id) {
|
|
1324
|
+
return this.request({
|
|
1325
|
+
method: 'put',
|
|
1326
|
+
url: `/channels/ ${channel_id}/${message_id}`
|
|
1327
|
+
}).then(res => res?.data);
|
|
1328
|
+
}
|
|
1329
|
+
/**
|
|
1330
|
+
* *********
|
|
1331
|
+
*取消置顶消息
|
|
1332
|
+
* *********
|
|
1333
|
+
*/
|
|
1334
|
+
async deletepinMessage(channel_id, message_id) {
|
|
1335
|
+
return this.request({
|
|
1336
|
+
method: 'delete',
|
|
1337
|
+
url: `/channels/ ${channel_id}/${message_id}`
|
|
1338
|
+
}).then(res => res?.data);
|
|
1339
|
+
}
|
|
1340
|
+
/**
|
|
1341
|
+
* ********
|
|
1342
|
+
* 日程api
|
|
1343
|
+
* *******
|
|
1344
|
+
*/
|
|
1345
|
+
/**
|
|
1346
|
+
* ***********
|
|
1347
|
+
* 表情表态api
|
|
1348
|
+
* ***********
|
|
1349
|
+
*/
|
|
1350
|
+
/**
|
|
1351
|
+
* *********
|
|
1352
|
+
*获取贴纸
|
|
1353
|
+
* *********
|
|
1354
|
+
*/
|
|
1355
|
+
async getsticker(sticker_id) {
|
|
1356
|
+
return this.request({
|
|
1357
|
+
method: 'get',
|
|
1358
|
+
url: `/stickers/${sticker_id}`
|
|
1359
|
+
}).then(res => res?.data);
|
|
1360
|
+
}
|
|
1361
|
+
/**
|
|
1362
|
+
* *********
|
|
1363
|
+
*列出贴纸包
|
|
1364
|
+
* *********
|
|
1365
|
+
*/
|
|
1366
|
+
async listStickerPacks() {
|
|
1367
|
+
return this.request({
|
|
1368
|
+
method: 'get',
|
|
1369
|
+
url: `/stickers`
|
|
1370
|
+
}).then(res => res?.data);
|
|
1371
|
+
}
|
|
1372
|
+
/**
|
|
1373
|
+
* *********
|
|
1374
|
+
*列出公会贴纸
|
|
1375
|
+
* *********
|
|
1376
|
+
*/
|
|
1377
|
+
async listGuildStickers(sticker_id) {
|
|
1378
|
+
return this.request({
|
|
1379
|
+
method: 'get',
|
|
1380
|
+
url: `/stickers/${sticker_id}/stickers`
|
|
1381
|
+
}).then(res => res?.data);
|
|
1382
|
+
}
|
|
1383
|
+
/**
|
|
1384
|
+
* *********
|
|
1385
|
+
*获取公会贴纸
|
|
1386
|
+
* *********
|
|
1387
|
+
*/
|
|
1388
|
+
async getGuildSticker(guild_id, sticker_id) {
|
|
1389
|
+
return this.request({
|
|
1390
|
+
method: 'get',
|
|
1391
|
+
url: `/guilds/${guild_id}/stickers/${sticker_id}`
|
|
1392
|
+
}).then(res => res?.data);
|
|
1393
|
+
}
|
|
1394
|
+
/**
|
|
1395
|
+
* *********
|
|
1396
|
+
*创建公会贴纸
|
|
1397
|
+
* *********
|
|
1398
|
+
*/
|
|
1399
|
+
async createGuildSticker(guild_id) {
|
|
1400
|
+
return this.request({
|
|
1401
|
+
method: 'post',
|
|
1402
|
+
url: `/guilds/${guild_id}/stickers`
|
|
1403
|
+
}).then(res => res?.data);
|
|
1404
|
+
}
|
|
1405
|
+
/**
|
|
1406
|
+
* *********
|
|
1407
|
+
*修改公会贴纸
|
|
1408
|
+
* *********
|
|
1409
|
+
*/
|
|
1410
|
+
async modifyGuildSticker(guild_id, sticker_id) {
|
|
1411
|
+
return this.request({
|
|
1412
|
+
method: 'PATCH',
|
|
1413
|
+
url: `/guilds/${guild_id}/stickers/${sticker_id}`
|
|
1414
|
+
}).then(res => res?.data);
|
|
1415
|
+
}
|
|
1416
|
+
/**
|
|
1417
|
+
* *********
|
|
1418
|
+
*删除公会贴纸
|
|
1419
|
+
* *********
|
|
1420
|
+
*/
|
|
1421
|
+
async deleteGuildSticker(guild_id, sticker_id) {
|
|
1422
|
+
return this.request({
|
|
1423
|
+
method: 'delete',
|
|
1424
|
+
url: `/guilds/${guild_id}/stickers/${sticker_id}`
|
|
1425
|
+
}).then(res => res?.data);
|
|
1426
|
+
}
|
|
1427
|
+
/**
|
|
1428
|
+
* *********
|
|
1429
|
+
*列出公会表情符号
|
|
1430
|
+
* *********
|
|
1431
|
+
*/
|
|
1432
|
+
async listGuildEmojis(guild_id) {
|
|
1433
|
+
return this.request({
|
|
1434
|
+
method: 'get',
|
|
1435
|
+
url: `/guilds/ ${guild_id} /emojis`
|
|
1436
|
+
}).then(res => res?.data);
|
|
1437
|
+
}
|
|
1438
|
+
/**
|
|
1439
|
+
* *********
|
|
1440
|
+
*获取公会表情符号
|
|
1441
|
+
* *********
|
|
1442
|
+
*/
|
|
1443
|
+
async getGuildEmoji(guild_id, emoji_id) {
|
|
1444
|
+
return this.request({
|
|
1445
|
+
method: 'get',
|
|
1446
|
+
url: `/guilds/ ${guild_id} /emojis/ ${emoji_id}`
|
|
1447
|
+
}).then(res => res?.data);
|
|
1448
|
+
}
|
|
1449
|
+
/**
|
|
1450
|
+
* *********
|
|
1451
|
+
*创建公会表情符号
|
|
1452
|
+
* *********
|
|
1453
|
+
*/
|
|
1454
|
+
async createGuildEmoji(guild_id) {
|
|
1455
|
+
return this.request({
|
|
1456
|
+
method: 'post',
|
|
1457
|
+
url: `/guilds/ ${guild_id} /emojis`
|
|
1458
|
+
}).then(res => res?.data);
|
|
1459
|
+
}
|
|
1460
|
+
/**
|
|
1461
|
+
* *********
|
|
1462
|
+
*修改公会表情
|
|
1463
|
+
* *********
|
|
1464
|
+
*/
|
|
1465
|
+
async modifyGuildEmoji(guild_id, emoji_id) {
|
|
1466
|
+
return this.request({
|
|
1467
|
+
method: 'PATCH',
|
|
1468
|
+
url: `/guilds/ ${guild_id} /emojis/ ${emoji_id}`
|
|
1469
|
+
}).then(res => res?.data);
|
|
1470
|
+
}
|
|
1471
|
+
/**
|
|
1472
|
+
* *********
|
|
1473
|
+
*删除公会表情符号
|
|
1474
|
+
* *********
|
|
1475
|
+
*/
|
|
1476
|
+
async deleteGuildEmoji(guild_id, emoji_id) {
|
|
1477
|
+
return this.request({
|
|
1478
|
+
method: 'delete',
|
|
1479
|
+
url: `/guilds/ ${guild_id} /emojis/ ${emoji_id}`
|
|
1480
|
+
}).then(res => res?.data);
|
|
1481
|
+
}
|
|
1482
|
+
/**
|
|
1483
|
+
* ***********
|
|
1484
|
+
* 音频api
|
|
1485
|
+
* **********
|
|
1486
|
+
*/
|
|
1487
|
+
/**
|
|
1488
|
+
* *********
|
|
1489
|
+
* 列出语音区域
|
|
1490
|
+
* *********
|
|
1491
|
+
*/
|
|
1492
|
+
async listVoiceRegions() {
|
|
1493
|
+
return this.request({
|
|
1494
|
+
method: 'get',
|
|
1495
|
+
url: `/voice/regions`
|
|
1496
|
+
}).then(res => res?.data);
|
|
1497
|
+
}
|
|
1498
|
+
/**
|
|
1499
|
+
* *********
|
|
1500
|
+
* 获取频道语音区域
|
|
1501
|
+
* *********
|
|
1502
|
+
*/
|
|
1503
|
+
async guildsRegions(guild_id) {
|
|
1504
|
+
return this.request({
|
|
1505
|
+
method: 'get',
|
|
1506
|
+
url: `/guilds/${guild_id}/regions`
|
|
1507
|
+
}).then(res => res?.data);
|
|
1508
|
+
}
|
|
1509
|
+
/**
|
|
1510
|
+
* *********
|
|
1511
|
+
* 修改当前用户语音状态
|
|
1512
|
+
* *********
|
|
1513
|
+
*/
|
|
1514
|
+
async guildsVoiveStatesMe(guild_id) {
|
|
1515
|
+
return this.request({
|
|
1516
|
+
method: 'PATCH',
|
|
1517
|
+
url: `/guilds/${guild_id}/voice-states/@me`
|
|
1518
|
+
}).then(res => res?.data);
|
|
1519
|
+
}
|
|
1520
|
+
/**
|
|
1521
|
+
* *********
|
|
1522
|
+
* 修改用户语音状态
|
|
1523
|
+
* *********
|
|
1524
|
+
*/
|
|
1525
|
+
async guildsVoiceStatesUpdate(guild_id, user_id) {
|
|
1526
|
+
return this.request({
|
|
1527
|
+
method: 'PATCH',
|
|
1528
|
+
url: `/guilds/${guild_id}/voice-states/${user_id}`
|
|
1529
|
+
}).then(res => res?.data);
|
|
1530
|
+
}
|
|
1531
|
+
/**
|
|
1532
|
+
* **********
|
|
1533
|
+
* 帖子api
|
|
1534
|
+
* **********
|
|
1535
|
+
*/
|
|
1536
|
+
/**
|
|
1537
|
+
* ********
|
|
1538
|
+
* 接口权限api
|
|
1539
|
+
* **********
|
|
1540
|
+
*/
|
|
1541
|
+
/**
|
|
1542
|
+
* ********
|
|
1543
|
+
* 通讯api
|
|
1544
|
+
* *********
|
|
1545
|
+
*/
|
|
1546
|
+
async gateway() {
|
|
1547
|
+
return this.request({
|
|
1548
|
+
method: 'get',
|
|
1549
|
+
url: '/gateway'
|
|
1550
|
+
}).then(res => res?.data);
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
export { DCAPI };
|