@alemonjs/discord 2.1.0-alpha.9 → 2.1.0

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