@alemonjs/discord 2.1.0-alpha.2 → 2.1.0-alpha.20

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