disgroove 1.3.0-dev.de929bd → 1.3.1-dev.8cd17af

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 (54) hide show
  1. package/dist/Client.d.ts +12 -4
  2. package/dist/Client.js +27 -1
  3. package/dist/Client.js.map +1 -1
  4. package/dist/gateway/Shard.d.ts +1 -0
  5. package/dist/gateway/Shard.js +14 -6
  6. package/dist/gateway/Shard.js.map +1 -1
  7. package/dist/index.d.ts +1 -0
  8. package/dist/index.js +1 -0
  9. package/dist/index.js.map +1 -1
  10. package/dist/rest/RequestsManager.js +1 -1
  11. package/dist/structures/Application.d.ts +3 -3
  12. package/dist/structures/Application.js.map +1 -1
  13. package/dist/structures/AutoModerationRule.d.ts +3 -3
  14. package/dist/structures/Channel.d.ts +8 -8
  15. package/dist/structures/Channel.js +1 -1
  16. package/dist/structures/Channel.js.map +1 -1
  17. package/dist/structures/ClientApplication.d.ts +324 -0
  18. package/dist/structures/ClientApplication.js +241 -0
  19. package/dist/structures/ClientApplication.js.map +1 -0
  20. package/dist/structures/Guild.d.ts +12 -12
  21. package/dist/structures/Guild.js +3 -3
  22. package/dist/structures/Guild.js.map +1 -1
  23. package/dist/structures/GuildScheduledEvent.js +2 -2
  24. package/dist/structures/GuildScheduledEvent.js.map +1 -1
  25. package/dist/structures/GuildTemplate.js +1 -3
  26. package/dist/structures/GuildTemplate.js.map +1 -1
  27. package/dist/structures/Integration.d.ts +1 -1
  28. package/dist/structures/Invite.d.ts +2 -1
  29. package/dist/structures/Invite.js.map +1 -1
  30. package/dist/structures/Message.d.ts +3 -3
  31. package/dist/structures/Message.js.map +1 -1
  32. package/dist/structures/SKU.d.ts +1 -1
  33. package/dist/structures/SKU.js +3 -3
  34. package/dist/structures/StageInstance.d.ts +1 -1
  35. package/dist/structures/StageInstance.js.map +1 -1
  36. package/dist/structures/UnavailableGuild.d.ts +2 -487
  37. package/dist/structures/UnavailableGuild.js +0 -877
  38. package/dist/structures/UnavailableGuild.js.map +1 -1
  39. package/dist/structures/User.d.ts +2 -2
  40. package/dist/structures/User.js +1 -1
  41. package/dist/structures/User.js.map +1 -1
  42. package/dist/structures/index.d.ts +1 -1
  43. package/dist/structures/index.js +1 -1
  44. package/dist/structures/index.js.map +1 -1
  45. package/dist/types/application.d.ts +3 -3
  46. package/dist/types/channel.d.ts +13 -13
  47. package/dist/types/guild.d.ts +2 -2
  48. package/dist/types/interaction.d.ts +8 -28
  49. package/dist/types/invite.d.ts +3 -2
  50. package/dist/types/sku.d.ts +1 -1
  51. package/dist/types/stage-instance.d.ts +3 -2
  52. package/dist/types/team.d.ts +1 -1
  53. package/dist/types/user.d.ts +3 -3
  54. package/package.json +2 -2
@@ -2,8 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UnavailableGuild = void 0;
4
4
  const _1 = require(".");
5
- const rest_1 = require("../rest");
6
- const undici_1 = require("undici");
7
5
  /** https://discord.com/developers/docs/resources/guild */
8
6
  class UnavailableGuild extends _1.Base {
9
7
  raw;
@@ -13,881 +11,6 @@ class UnavailableGuild extends _1.Base {
13
11
  this.raw = data;
14
12
  this.unavailable = data.unavailable;
15
13
  }
16
- /** https://discord.com/developers/docs/resources/guild#add-guild-member */
17
- async addMember(userId, options) {
18
- return this.client.rest
19
- .put(rest_1.Endpoints.guildMember(this.id, userId), {
20
- json: {
21
- access_token: options.accessToken,
22
- nick: options.nick,
23
- roles: options.roles,
24
- mute: options.mute,
25
- deaf: options.deaf,
26
- },
27
- })
28
- .then((response) => {
29
- if (response !== null) {
30
- return new _1.GuildMember(response, this.client);
31
- }
32
- else
33
- return null;
34
- });
35
- }
36
- /** https://discord.com/developers/docs/resources/guild#add-guild-member-role */
37
- addMemberRole(userId, roleId, reason) {
38
- this.client.rest.put(rest_1.Endpoints.guildMemberRole(this.id, userId, roleId), {
39
- reason,
40
- });
41
- }
42
- /** https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands */
43
- async bulkEditApplicationCommands(applicationId, commands) {
44
- return this.client.rest
45
- .put(rest_1.Endpoints.applicationGuildCommands(applicationId, this.id), {
46
- json: commands.map((command) => this.client.util.applicationCommandToRaw(command)),
47
- })
48
- .then((response) => response.map((data) => new _1.ApplicationCommand(data, this.client)));
49
- }
50
- /** https://discord.com/developers/docs/resources/guild#begin-guild-prune */
51
- async beginGuildPrune(options, reason) {
52
- return this.client.rest.post(rest_1.Endpoints.guildPrune(this.id), {
53
- json: {
54
- days: options.days,
55
- compute_prune_count: options.computePruneCount,
56
- include_roles: options.includeRoles,
57
- reason: options.reason,
58
- },
59
- reason,
60
- });
61
- }
62
- /** https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command */
63
- async createApplicationCommand(applicationId, options) {
64
- return new _1.ApplicationCommand(await this.client.rest.post(rest_1.Endpoints.applicationGuildCommands(applicationId, this.id), {
65
- json: this.client.util.applicationCommandToRaw(options),
66
- }), this.client);
67
- }
68
- /** https://discord.com/developers/docs/resources/auto-moderation#create-auto-moderation-rule */
69
- async createAutoModerationRule(options, reason) {
70
- return new _1.AutoModerationRule(await this.client.rest.post(rest_1.Endpoints.guildAutoModerationRules(this.id), {
71
- json: {
72
- name: options.name,
73
- event_type: options.eventType,
74
- trigger_type: options.triggerType,
75
- trigger_metadata: options.triggerMetadata,
76
- actions: options.actions.map((action) => ({
77
- type: action.type,
78
- metadata: {
79
- channel_id: action.metadata.channelId,
80
- duration_seconds: action.metadata.durationSeconds,
81
- custom_message: action.metadata.customMessage,
82
- },
83
- })),
84
- enabled: options.enabled,
85
- exempt_roles: options.exemptRoles,
86
- exempt_channels: options.exemptChannels,
87
- },
88
- reason,
89
- }), this.client);
90
- }
91
- /** https://discord.com/developers/docs/resources/guild#create-guild-ban */
92
- createBan(userId, options, reason) {
93
- this.client.rest.put(rest_1.Endpoints.guildBan(this.id, userId), {
94
- json: {
95
- delete_message_days: options?.deleteMessageDays,
96
- delete_message_seconds: options?.deleteMessageSeconds,
97
- },
98
- reason,
99
- });
100
- }
101
- /** https://discord.com/developers/docs/resources/guild#create-guild-channel */
102
- async createChannel(options, reason) {
103
- return new _1.Channel(await this.client.rest.post(rest_1.Endpoints.guildChannels(this.id), {
104
- json: {
105
- name: options.name,
106
- type: options.type,
107
- topic: options.topic,
108
- bitrate: options.bitrate,
109
- user_limit: options.userLimit,
110
- rate_limit_per_user: options.rateLimitPerUser,
111
- position: options.position,
112
- permission_overwrites: options.permissionOverwrites,
113
- parent_id: options.parentId,
114
- nsfw: options.nsfw,
115
- rtc_region: options.rtcRegion,
116
- video_quality_mode: options.videoQualityMode,
117
- default_auto_archive_duration: options.defaultAutoArchiveDuration,
118
- default_reaction_emoji: {
119
- emojiId: options.defaultReactionEmoji?.emojiId,
120
- emojiName: options.defaultReactionEmoji?.emojiName,
121
- },
122
- available_tags: options.availableTags,
123
- default_sort_order: options.defaultSortOrder,
124
- default_forum_layout: options.defaultForumLayout,
125
- default_thread_rate_limit_per_user: options.defaultThreadRateLimitPerUser,
126
- },
127
- reason,
128
- }), this.client);
129
- }
130
- /** https://discord.com/developers/docs/resources/emoji#create-guild-emoji */
131
- async createEmoji(options, reason) {
132
- return new _1.Emoji(await this.client.rest.post(rest_1.Endpoints.guildEmojis(this.id), {
133
- json: {
134
- name: options.name,
135
- image: options.image,
136
- roles: options.roles,
137
- },
138
- reason,
139
- }), this.client);
140
- }
141
- /** https://discord.com/developers/docs/resources/guild#create-guild-role */
142
- async createRole(options, reason) {
143
- return new _1.Role(await this.client.rest.post(rest_1.Endpoints.guildRoles(this.id), {
144
- json: {
145
- name: options.name,
146
- permissions: options.permissions,
147
- color: options.color,
148
- hoist: options.hoist,
149
- icon: options.icon,
150
- unicode_emoji: options.unicodeEmoji,
151
- mentionable: options.mentionable,
152
- },
153
- reason,
154
- }), this.client);
155
- }
156
- /** https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event */
157
- async createScheduledEvent(options, reason) {
158
- return new _1.GuildScheduledEvent(await this.client.rest.post(rest_1.Endpoints.guildScheduledEvents(this.id), {
159
- json: {
160
- channel_id: options.channelId,
161
- entity_metadata: options.entityMetadata,
162
- name: options.name,
163
- privacy_level: options.privacyLevel,
164
- scheduled_start_time: options.scheduledEndTime,
165
- scheduled_end_time: options.scheduledEndTime,
166
- description: options.description,
167
- entity_type: options.entityType,
168
- image: options.image,
169
- },
170
- reason,
171
- }), this.client);
172
- }
173
- /** https://discord.com/developers/docs/resources/sticker#create-guild-sticker */
174
- async createSticker(options, reason) {
175
- const formData = new undici_1.FormData();
176
- formData.set("name", options.name);
177
- formData.set("description", options.description);
178
- formData.set("tags", options.tags);
179
- formData.set("file", new undici_1.File([options.file.contents], options.file.name));
180
- return this.client.rest
181
- .post(rest_1.Endpoints.guildStickers(this.id), {
182
- form: formData,
183
- reason,
184
- })
185
- .then((response) => new _1.Sticker(response, this.client));
186
- }
187
- /** https://discord.com/developers/docs/resources/guild-template#create-guild-template */
188
- async createTemplate(options) {
189
- return new _1.GuildTemplate(await this.client.rest.post(rest_1.Endpoints.guildTemplates(this.id), {
190
- json: {
191
- name: options.name,
192
- description: options.description,
193
- },
194
- }), this.client);
195
- }
196
- /** https://discord.com/developers/docs/resources/guild#delete-guild */
197
- delete() {
198
- this.client.rest.delete(rest_1.Endpoints.guild(this.id));
199
- }
200
- /** https://discord.com/developers/docs/interactions/application-commands#delete-guild-application-command */
201
- deleteApplicationCommand(applicationId, commandId) {
202
- this.client.rest.delete(rest_1.Endpoints.applicationGuildCommand(applicationId, this.id, commandId));
203
- }
204
- /** https://discord.com/developers/docs/resources/auto-moderation#delete-auto-moderation-rule */
205
- deleteAutoModerationRule(ruleId, reason) {
206
- this.client.rest.delete(rest_1.Endpoints.guildAutoModerationRule(this.id, ruleId), {
207
- reason,
208
- });
209
- }
210
- /** https://discord.com/developers/docs/resources/emoji#delete-guild-emoji */
211
- deleteEmoji(emojiId, reason) {
212
- this.client.rest.delete(rest_1.Endpoints.guildEmoji(this.id, emojiId), {
213
- reason,
214
- });
215
- }
216
- /** https://discord.com/developers/docs/resources/guild#delete-guild-integration */
217
- deleteIntegration(integrationId, reason) {
218
- this.client.rest.delete(rest_1.Endpoints.guildIntegration(this.id, integrationId), {
219
- reason,
220
- });
221
- }
222
- /** https://discord.com/developers/docs/resources/guild#delete-guild-role */
223
- deleteRole(roleId, reason) {
224
- this.client.rest.delete(rest_1.Endpoints.guildRole(this.id, roleId), {
225
- reason,
226
- });
227
- }
228
- /** https://discord.com/developers/docs/resources/guild-scheduled-event#delete-guild-scheduled-event */
229
- deleteScheduledEvent(scheduledEventId) {
230
- this.client.rest.delete(rest_1.Endpoints.guildScheduledEvent(this.id, scheduledEventId));
231
- }
232
- /** https://discord.com/developers/docs/resources/sticker#delete-guild-sticker */
233
- deleteSticker(stickerId, reason) {
234
- this.client.rest.delete(rest_1.Endpoints.guildSticker(this.id, stickerId), {
235
- reason,
236
- });
237
- }
238
- /** https://discord.com/developers/docs/resources/guild-template#delete-guild-template */
239
- async deleteTemplate(code) {
240
- return this.client.rest
241
- .delete(rest_1.Endpoints.guildTemplate(this.id, code))
242
- .then((response) => new _1.GuildTemplate(response, this.client).toJSON());
243
- }
244
- /** https://discord.com/developers/docs/resources/guild#modify-guild */
245
- async edit(options, reason) {
246
- return new _1.Guild(await this.client.rest.patch(rest_1.Endpoints.guild(this.id), {
247
- json: {
248
- name: options.name,
249
- region: options.region,
250
- verification_level: options.verificationLevel,
251
- default_message_notifications: options.defaultMessageNotifications,
252
- explicit_content_filter: options.explicitContentFilter,
253
- afk_channel_id: options.afkChannelId,
254
- afk_timeout: options.afkTimeout,
255
- icon: options.icon,
256
- owner_id: options.ownerId,
257
- splash: options.splash,
258
- discovery_splash: options.discoverySplash,
259
- banner: options.banner,
260
- system_channel_id: options.systemChannelId,
261
- system_channel_flags: options.systemChannelFlags,
262
- rules_channel_id: options.rulesChannelId,
263
- public_updates_channel_id: options.publicUpdatesChannelId,
264
- preferred_locale: options.preferredLocale,
265
- features: options.features,
266
- description: options.description,
267
- premium_progress_bar_enabled: options.premiumProgressBarEnabled,
268
- safety_alerts_channel_id: options.safetyAlertsChannelId,
269
- },
270
- reason,
271
- }), this.client);
272
- }
273
- /** https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command */
274
- async editApplicationCommand(applicationId, commandId, options) {
275
- return new _1.ApplicationCommand(await this.client.rest.patch(rest_1.Endpoints.applicationGuildCommand(applicationId, this.id, commandId), {
276
- json: this.client.util.applicationCommandToRaw(options),
277
- }), this.client);
278
- }
279
- /** https://discord.com/developers/docs/resources/auto-moderation#modify-auto-moderation-rule */
280
- async editAutoModerationRule(ruleId, options, reason) {
281
- return new _1.AutoModerationRule(await this.client.rest.patch(rest_1.Endpoints.guildAutoModerationRule(this.id, ruleId), {
282
- json: {
283
- name: options.name,
284
- event_type: options.eventType,
285
- trigger_type: options.triggerType,
286
- trigger_metadata: options.triggerMetadata,
287
- actions: options.actions?.map((action) => ({
288
- type: action.type,
289
- metadata: {
290
- channel_id: action.metadata.channelId,
291
- duration_seconds: action.metadata.durationSeconds,
292
- custom_message: action.metadata.customMessage,
293
- },
294
- })),
295
- enabled: options.enabled,
296
- exempt_roles: options.exemptRoles,
297
- exempt_channels: options.exemptChannels,
298
- },
299
- reason,
300
- }), this.client);
301
- }
302
- /** https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions */
303
- editChannelPositions(options) {
304
- this.client.rest.patch(rest_1.Endpoints.guildChannels(this.id), {
305
- json: options.map((data) => ({
306
- id: data.id,
307
- position: data.position,
308
- lock_permissions: data.lockPermissions,
309
- parent_id: data.parentId,
310
- })),
311
- });
312
- }
313
- /** https://discord.com/developers/docs/resources/guild#modify-current-member */
314
- async editCurrentMember(options, reason) {
315
- return new _1.GuildMember(await this.client.rest.patch(rest_1.Endpoints.guildMember(this.id), {
316
- json: {
317
- nick: options.nick,
318
- },
319
- reason,
320
- }), this.client);
321
- }
322
- /** https://discord.com/developers/docs/resources/guild#modify-current-user-voice-state */
323
- editCurrentUserVoiceState(options) {
324
- this.client.rest.patch(rest_1.Endpoints.guildVoiceState(this.id), {
325
- json: {
326
- channel_id: options.channelId,
327
- suppress: options.suppress,
328
- requestToSpeakTimestamp: options.requestToSpeakTimestamp,
329
- },
330
- });
331
- }
332
- /** https://discord.com/developers/docs/resources/emoji#modify-guild-emoji */
333
- async editEmoji(emojiId, options, reason) {
334
- return new _1.Emoji(await this.client.rest.patch(rest_1.Endpoints.guildEmoji(this.id, emojiId), {
335
- json: {
336
- name: options.name,
337
- roles: options.roles,
338
- },
339
- reason,
340
- }), this.client);
341
- }
342
- /** https://discord.com/developers/docs/resources/guild#modify-guild-member */
343
- async editMember(userId, options, reason) {
344
- return new _1.GuildMember(await this.client.rest.patch(rest_1.Endpoints.guildMember(this.id, userId), {
345
- json: {
346
- nick: options.nick,
347
- roles: options.roles,
348
- mute: options.mute,
349
- deaf: options.deaf,
350
- channel_id: options.channelId,
351
- communication_disabled_until: options.communicationDisabledUntil,
352
- flags: options.flags,
353
- },
354
- reason,
355
- }), this.client);
356
- }
357
- /** https://discord.com/developers/docs/resources/guild#modify-guild-mfa-level */
358
- async editMFALevel(options, reason) {
359
- return this.client.rest.post(rest_1.Endpoints.guildMFA(this.id), {
360
- json: {
361
- level: options.level,
362
- },
363
- reason,
364
- });
365
- }
366
- /** https://discord.com/developers/docs/resources/guild#modify-guild-onboarding */
367
- editOnboarding(options, reason) {
368
- this.client.rest.patch(rest_1.Endpoints.guildOnboarding(this.id), {
369
- json: {
370
- prompts: options.prompts.map((prompt) => ({
371
- id: prompt.id,
372
- type: prompt.type,
373
- options: prompt.options.map((option) => ({
374
- id: option.id,
375
- channel_ids: option.channelIds,
376
- role_ids: option.roleIds,
377
- emoji: option.emoji !== undefined
378
- ? {
379
- id: option.emoji.id,
380
- name: option.emoji.name,
381
- roles: option.emoji.roles,
382
- user: option.emoji.user,
383
- require_colons: option.emoji.requireColons,
384
- managed: option.emoji.managed,
385
- animated: option.emoji.animated,
386
- available: option.emoji.available,
387
- }
388
- : undefined,
389
- emoji_id: option.emojiId,
390
- emoji_name: option.emojiName,
391
- emoji_animated: option.emojiAnimated,
392
- title: option.title,
393
- description: option.description,
394
- })),
395
- title: prompt.title,
396
- single_select: prompt.singleSelect,
397
- required: prompt.required,
398
- in_onboarding: prompt.inOnboarding,
399
- })),
400
- },
401
- reason,
402
- });
403
- }
404
- /** https://discord.com/developers/docs/resources/guild#modify-guild-role */
405
- async editRole(roleId, options, reason) {
406
- return new _1.Role(await this.client.rest.patch(rest_1.Endpoints.guildRole(this.id, roleId), {
407
- json: {
408
- name: options?.name,
409
- permissions: options?.permissions,
410
- color: options?.color,
411
- hoist: options?.hoist,
412
- icon: options?.icon,
413
- unicode_emoji: options?.unicodeEmoji,
414
- mentionable: options?.mentionable,
415
- },
416
- reason,
417
- }), this.client);
418
- }
419
- /** https://discord.com/developers/docs/resources/guild#modify-guild-role-positions */
420
- async editRolePositions(options) {
421
- return this.client.rest
422
- .patch(rest_1.Endpoints.guildRoles(this.id), {
423
- json: options.map((data) => ({
424
- id: data.id,
425
- position: data.position,
426
- })),
427
- })
428
- .then((response) => response.map((data) => new _1.Role(data, this.client)));
429
- }
430
- /** https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event */
431
- async editScheduledEvent(scheduledEventId, options, reason) {
432
- return new _1.GuildScheduledEvent(await this.client.rest.patch(rest_1.Endpoints.guildScheduledEvent(this.id, scheduledEventId), {
433
- json: {
434
- channel_id: options.channelId,
435
- entity_metadata: options.entityMetadata,
436
- name: options.name,
437
- privacy_level: options.privacyLevel,
438
- scheduled_start_time: options.scheduledStartTime,
439
- scheduled_end_time: options.scheduledEndTime,
440
- description: options.description,
441
- entityType: options.entityType,
442
- status: options.status,
443
- image: options.image,
444
- },
445
- reason,
446
- }), this.client);
447
- }
448
- /** https://discord.com/developers/docs/resources/sticker#modify-guild-sticker */
449
- async editSticker(stickerId, options, reason) {
450
- return this.client.rest
451
- .patch(rest_1.Endpoints.guildSticker(this.id, stickerId), {
452
- json: {
453
- name: options.name,
454
- description: options.description,
455
- tags: options.tags,
456
- },
457
- reason,
458
- })
459
- .then((response) => new _1.Sticker(response, this.client));
460
- }
461
- /** https://discord.com/developers/docs/resources/guild-template#modify-guild-template */
462
- async editTemplate(code, options) {
463
- return new _1.GuildTemplate(await this.client.rest.patch(rest_1.Endpoints.guildTemplate(this.id, code), {
464
- json: {
465
- name: options.name,
466
- description: options.description,
467
- },
468
- }), this.client);
469
- }
470
- /** https://discord.com/developers/docs/resources/guild#modify-user-voice-state */
471
- editUserVoiceState(userId, options) {
472
- this.client.rest.patch(rest_1.Endpoints.guildVoiceState(this.id, userId), {
473
- json: {
474
- channel_id: options.channelId,
475
- suppress: options.suppress,
476
- requestToSpeakTimestamp: options.requestToSpeakTimestamp,
477
- },
478
- });
479
- }
480
- /** https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen */
481
- async editWelcomeScreen(options, reason) {
482
- return this.client.rest
483
- .patch(rest_1.Endpoints.guildWelcomeScreen(this.id), {
484
- json: {
485
- enabled: options.enabled,
486
- welcome_channels: options.welcomeChannels,
487
- description: options.description,
488
- },
489
- reason,
490
- })
491
- .then((response) => ({
492
- description: response.description,
493
- welcomeChannels: response.welcome_channels.map((data) => ({
494
- channelId: data.channel_id,
495
- description: data.description,
496
- emojiId: data.emoji_id,
497
- emojiName: data.emoji_name,
498
- })),
499
- }));
500
- }
501
- /** https://discord.com/developers/docs/resources/guild#modify-guild-widget */
502
- async editWidget(options, reason) {
503
- return this.client.rest
504
- .patch(rest_1.Endpoints.guildWidgetSettings(this.id), {
505
- json: {
506
- enabled: options.enabled,
507
- channel_id: options.channelId,
508
- },
509
- reason,
510
- })
511
- .then((response) => ({
512
- enabled: response.enabled,
513
- channelId: response.channel_id,
514
- }));
515
- }
516
- /** https://discord.com/developers/docs/resources/guild#list-active-guild-threads */
517
- async getActiveThreads() {
518
- return this.client.rest
519
- .get(rest_1.Endpoints.guildActiveThreads(this.id))
520
- .then((response) => response.map((data) => ({
521
- threads: data.threads.map((data) => new _1.Channel(data, this.client)),
522
- members: data.members.map((data) => ({
523
- id: data.id,
524
- userId: data.user_id,
525
- joinTimestamp: data.join_timestamp,
526
- flags: data.flags,
527
- member: data.member !== undefined
528
- ? new _1.GuildMember(data.member, this.client)
529
- : undefined,
530
- })),
531
- })));
532
- }
533
- /** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command */
534
- async getApplicationCommand(applicationId, commandId) {
535
- return new _1.ApplicationCommand(await this.client.rest.get(rest_1.Endpoints.applicationGuildCommand(applicationId, this.id, commandId)), this.client);
536
- }
537
- /** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands */
538
- async getApplicationCommands(applicationId, options) {
539
- return this.client.rest
540
- .get(rest_1.Endpoints.applicationGuildCommands(applicationId, this.id), {
541
- query: {
542
- with_localizations: options?.withLocalizations,
543
- },
544
- })
545
- .then((response) => response.map((data) => new _1.ApplicationCommand(data, this.client)));
546
- }
547
- /** https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions */
548
- async getApplicationCommandPermissions(applicationId, commandId) {
549
- return this.client.rest
550
- .get(rest_1.Endpoints.applicationCommandPermissions(applicationId, this.id, commandId))
551
- .then((response) => response.map((permissions) => ({
552
- id: permissions.id,
553
- applicationId: permissions.application_id,
554
- guildId: permissions.guild_id,
555
- permissions: permissions.permissions.map((permission) => ({
556
- id: permission.id,
557
- type: permission.type,
558
- permission: permission.permission,
559
- })),
560
- })));
561
- }
562
- /** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions */
563
- async getApplicationCommandsPermissions(applicationId) {
564
- return this.client.rest
565
- .get(rest_1.Endpoints.guildApplicationCommandsPermissions(applicationId, this.id))
566
- .then((response) => response.map((permissions) => ({
567
- id: permissions.id,
568
- applicationId: permissions.application_id,
569
- guildId: permissions.guild_id,
570
- permissions: permissions.permissions.map((permission) => ({
571
- id: permission.id,
572
- type: permission.type,
573
- permission: permission.permission,
574
- })),
575
- })));
576
- }
577
- /** https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log */
578
- async getAuditLog(options) {
579
- return new _1.AuditLog(await this.client.rest.get(rest_1.Endpoints.guildAuditLog(this.id), {
580
- query: {
581
- user_id: options?.userId,
582
- action_type: options?.actionType,
583
- before: options?.before,
584
- after: options?.after,
585
- limit: options?.limit,
586
- },
587
- }), this.client);
588
- }
589
- /** https://discord.com/developers/docs/resources/auto-moderation#get-auto-moderation-rule */
590
- async getAutoModerationRule(ruleId) {
591
- return new _1.AutoModerationRule(await this.client.rest.get(rest_1.Endpoints.guildAutoModerationRule(this.id, ruleId)), this.client);
592
- }
593
- /** https://discord.com/developers/docs/resources/auto-moderation#list-auto-moderation-rules-for-guild */
594
- async getAutoModerationRules() {
595
- return this.client.rest
596
- .get(rest_1.Endpoints.guildAutoModerationRules(this.id))
597
- .then((response) => response.map((data) => new _1.AutoModerationRule(data, this.client)));
598
- }
599
- /** https://discord.com/developers/docs/resources/guild#get-guild-ban */
600
- async getBan(userId) {
601
- return this.client.rest
602
- .get(rest_1.Endpoints.guildBan(this.id, userId))
603
- .then((response) => ({
604
- reason: response.reason,
605
- user: new _1.User(response.user, this.client),
606
- }));
607
- }
608
- /** https://discord.com/developers/docs/resources/guild#get-guild-bans */
609
- async getBans(options) {
610
- return this.client.rest
611
- .get(rest_1.Endpoints.guildBans(this.id), {
612
- query: {
613
- limit: options?.limit,
614
- before: options?.before,
615
- after: options?.after,
616
- },
617
- })
618
- .then((response) => response.map((data) => ({
619
- reason: data.reason,
620
- user: new _1.User(data.user, this.client),
621
- })));
622
- }
623
- /** https://discord.com/developers/docs/resources/guild#get-guild-channels */
624
- async getChannels() {
625
- return this.client.rest
626
- .get(rest_1.Endpoints.guildChannels(this.id))
627
- .then((response) => response.map((data) => new _1.Channel(data, this.client)));
628
- }
629
- /** https://discord.com/developers/docs/resources/emoji#get-guild-emoji */
630
- async getEmoji(emojiId) {
631
- return new _1.Emoji(await this.client.rest.get(rest_1.Endpoints.guildEmoji(this.id, emojiId)), this.client);
632
- }
633
- /** https://discord.com/developers/docs/resources/emoji#list-guild-emojis */
634
- async getEmojis() {
635
- return this.client.rest
636
- .get(rest_1.Endpoints.guildEmojis(this.id))
637
- .then((response) => response.map((data) => new _1.Emoji(data, this.client)));
638
- }
639
- /** https://discord.com/developers/docs/resources/guild#get-guild-integrations */
640
- async getIntegrations() {
641
- return this.client.rest
642
- .get(rest_1.Endpoints.guildIntegrations(this.id))
643
- .then((response) => response.map((data) => new _1.Integration(data, this.client)));
644
- }
645
- /** https://discord.com/developers/docs/resources/guild#get-guild-invites */
646
- async getInvites() {
647
- return this.client.rest
648
- .get(rest_1.Endpoints.guildInvites(this.id))
649
- .then((response) => response.map((data) => new _1.Invite(data, this.client)));
650
- }
651
- /** https://discord.com/developers/docs/resources/guild#get-guild-member */
652
- async getMember(userId) {
653
- return new _1.GuildMember(await this.client.rest.get(rest_1.Endpoints.guildMember(this.id, userId)), this.client);
654
- }
655
- /** https://discord.com/developers/docs/resources/guild#list-guild-members */
656
- async getMembers() {
657
- return this.client.rest
658
- .get(rest_1.Endpoints.guildMembers(this.id))
659
- .then((response) => response.map((data) => new _1.GuildMember(data, this.client)));
660
- }
661
- /** https://discord.com/developers/docs/resources/guild#get-guild-onboarding */
662
- async getOnboarding() {
663
- return this.client.rest
664
- .get(rest_1.Endpoints.guildOnboarding(this.id))
665
- .then((response) => ({
666
- guildId: response.guild_id,
667
- prompts: response.prompts.map((prompt) => ({
668
- id: prompt.id,
669
- type: prompt.type,
670
- options: prompt.options.map((option) => ({
671
- id: option.id,
672
- channelIds: option.channel_ids,
673
- roleIds: option.role_ids,
674
- emoji: option.emoji !== undefined
675
- ? new _1.Emoji(option.emoji, this.client)
676
- : undefined,
677
- emojiId: option.emoji_id,
678
- emojiName: option.emoji_name,
679
- emojiAnimated: option.emoji_animated,
680
- title: option.title,
681
- description: option.description,
682
- })),
683
- title: prompt.title,
684
- singleSelect: prompt.single_select,
685
- required: prompt.required,
686
- inOnboarding: prompt.in_onboarding,
687
- })),
688
- defaultChannelIds: response.default_channel_ids,
689
- enabled: response.enabled,
690
- mode: response.mode,
691
- }));
692
- }
693
- /** https://discord.com/developers/docs/resources/guild#get-guild-preview */
694
- async getPreview() {
695
- return this.client.rest
696
- .get(rest_1.Endpoints.guildPreview(this.id))
697
- .then((response) => ({
698
- id: response.id,
699
- name: response.name,
700
- icon: response.icon,
701
- splash: response.splash,
702
- discoverySplash: response.discovery_splash,
703
- emojis: response.emojis.map((emoji) => new _1.Emoji(emoji, this.client)),
704
- features: response.features,
705
- approximateMemberCount: response.approximate_member_count,
706
- approximatePresenceCount: response.approximate_presence_count,
707
- description: response.description,
708
- stickers: response.stickers?.map((sticker) => ({
709
- id: sticker.id,
710
- packId: sticker.pack_id,
711
- name: sticker.name,
712
- description: sticker.description,
713
- tags: sticker.tags,
714
- asset: sticker.asset,
715
- type: sticker.type,
716
- formatType: sticker.format_type,
717
- available: sticker.available,
718
- guildId: sticker.guild_id,
719
- user: sticker.user !== undefined
720
- ? new _1.User(sticker.user, this.client)
721
- : undefined,
722
- sortValue: sticker.sort_value,
723
- })),
724
- }));
725
- }
726
- /** https://discord.com/developers/docs/resources/guild#get-guild-prune-count */
727
- async getPruneCount(options) {
728
- return this.client.rest.get(rest_1.Endpoints.guildPrune(this.id), {
729
- query: {
730
- days: options.days,
731
- include_roles: options.includeRoles,
732
- },
733
- });
734
- }
735
- /** https://discord.com/developers/docs/resources/guild#get-guild-roles */
736
- async getRoles() {
737
- return this.client.rest
738
- .get(rest_1.Endpoints.guildRoles(this.id))
739
- .then((response) => response.map((data) => new _1.Role(data, this.client)));
740
- }
741
- /** https://discord.com/developers/docs/resources/guild-scheduled-event#list-scheduled-events-for-guild */
742
- async getScheduledEvents(options) {
743
- return this.client.rest
744
- .get(rest_1.Endpoints.guildScheduledEvents(this.id), {
745
- query: {
746
- with_user_count: options?.withUserCount,
747
- },
748
- })
749
- .then((response) => response.map((data) => new _1.GuildScheduledEvent(data, this.client)));
750
- }
751
- /** https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event-users */
752
- async getScheduledEventUsers(scheduledEventId, options) {
753
- return this.client.rest
754
- .get(rest_1.Endpoints.guildScheduledEvent(this.id, scheduledEventId), {
755
- query: {
756
- limit: options?.limit,
757
- with_member: options?.withMember,
758
- before: options?.before,
759
- after: options?.after,
760
- },
761
- })
762
- .then((response) => response.map((data) => ({
763
- guildScheduledEventId: data.guild_scheduled_event_id,
764
- user: new _1.User(data.user, this.client),
765
- member: data.member !== undefined
766
- ? new _1.GuildMember(data.member, this.client)
767
- : undefined,
768
- })));
769
- }
770
- /** https://discord.com/developers/docs/resources/sticker#get-guild-sticker */
771
- async getSticker(stickerId) {
772
- return this.client.rest
773
- .get(rest_1.Endpoints.guildSticker(this.id, stickerId))
774
- .then((response) => new _1.Sticker(response, this.client));
775
- }
776
- /** https://discord.com/developers/docs/resources/sticker#list-guild-stickers */
777
- async getStickers() {
778
- return this.client.rest
779
- .get(rest_1.Endpoints.guildStickers(this.id))
780
- .then((response) => response.map((data) => new _1.Sticker(data, this.client)));
781
- }
782
- /** https://discord.com/developers/docs/resources/guild-template#get-guild-template */
783
- async getTemplate(code) {
784
- return new _1.GuildTemplate(await this.client.rest.get(rest_1.Endpoints.guildTemplate(this.id, code)), this.client);
785
- }
786
- /** https://discord.com/developers/docs/resources/guild-template#get-guild-templates */
787
- async getTemplates() {
788
- return this.client.rest
789
- .get(rest_1.Endpoints.guildTemplates(this.id))
790
- .then((response) => response.map((data) => new _1.GuildTemplate(data, this.client)));
791
- }
792
- /** https://discord.com/developers/docs/resources/guild#get-guild-vanity-url */
793
- getVanityURL() {
794
- return this.client.rest.get(rest_1.Endpoints.guildVanityURL(this.id));
795
- }
796
- /** https://discord.com/developers/docs/resources/guild#get-guild-voice-regions */
797
- async getVoiceRegions() {
798
- return this.client.rest
799
- .get(rest_1.Endpoints.guildVoiceRegions(this.id))
800
- .then((response) => response.map((data) => ({
801
- id: data.id,
802
- name: data.name,
803
- optimal: data.optimal,
804
- deprecated: data.deprecated,
805
- custom: data.custom,
806
- })));
807
- }
808
- /** https://discord.com/developers/docs/resources/webhook#get-guild-webhooks */
809
- async getWebhooks() {
810
- return this.client.rest
811
- .get(rest_1.Endpoints.guildWebhooks(this.id))
812
- .then((response) => response.map((data) => new _1.Webhook(data, this.client)));
813
- }
814
- /** https://discord.com/developers/docs/resources/guild#get-guild-welcome-screen */
815
- async getWelcomeScreen() {
816
- return this.client.rest
817
- .get(rest_1.Endpoints.guildWelcomeScreen(this.id))
818
- .then((response) => ({
819
- description: response.description,
820
- welcomeChannels: response.welcome_channels.map((data) => ({
821
- channelId: data.channel_id,
822
- description: data.description,
823
- emojiId: data.emoji_id,
824
- emojiName: data.emoji_name,
825
- })),
826
- }));
827
- }
828
- /** https://discord.com/developers/docs/resources/guild#get-guild-widget */
829
- async getWidget() {
830
- return this.client.rest
831
- .get(rest_1.Endpoints.guildWidgetJSON(this.id))
832
- .then((response) => ({
833
- id: response.id,
834
- name: response.name,
835
- instantInvite: response.instant_invite,
836
- channels: response.channels.map((data) => new _1.Channel(data, this.client)),
837
- members: response.members.map((data) => new _1.User(data, this.client)),
838
- presenceCount: response.presence_count,
839
- }));
840
- }
841
- /** https://discord.com/developers/docs/resources/guild#get-guild-widget-image */
842
- async getWidgetImage(options) {
843
- return this.client.rest.get(rest_1.Endpoints.guildWidgetImage(this.id), {
844
- query: {
845
- style: options?.style,
846
- },
847
- });
848
- }
849
- /** https://discord.com/developers/docs/resources/guild#get-guild-widget-settings */
850
- async getWidgetSettings() {
851
- return this.client.rest
852
- .get(rest_1.Endpoints.guildWidgetSettings(this.id))
853
- .then((response) => ({
854
- enabled: response.enabled,
855
- channelId: response.channel_id,
856
- }));
857
- }
858
- /** https://discord.com/developers/docs/resources/guild#remove-guild-ban */
859
- removeBan(userId, reason) {
860
- this.client.rest.delete(rest_1.Endpoints.guildBan(this.id, userId), {
861
- reason,
862
- });
863
- }
864
- /** https://discord.com/developers/docs/resources/guild#remove-guild-member-role */
865
- removeMember(userId, reason) {
866
- this.client.rest.delete(rest_1.Endpoints.guildMember(this.id, userId), {
867
- reason,
868
- });
869
- }
870
- /** https://discord.com/developers/docs/resources/guild#remove-guild-member-role */
871
- removeMemberRole(userId, roleId, reason) {
872
- this.client.rest.delete(rest_1.Endpoints.guildMemberRole(this.id, userId, roleId), {
873
- reason,
874
- });
875
- }
876
- /** https://discord.com/developers/docs/resources/guild#search-guild-members */
877
- async searchMembers(options) {
878
- return this.client.rest
879
- .get(rest_1.Endpoints.guildMembersSearch(this.id), {
880
- query: {
881
- query: options.query,
882
- limit: options.limit,
883
- },
884
- })
885
- .then((response) => response.map((data) => new _1.GuildMember(data, this.client)));
886
- }
887
- /** https://discord.com/developers/docs/resources/guild-template#sync-guild-template */
888
- async syncTemplate(code) {
889
- return new _1.GuildTemplate(await this.client.rest.put(rest_1.Endpoints.guildTemplate(this.id, code)), this.client);
890
- }
891
14
  toRaw() {
892
15
  return this.raw;
893
16
  }