disgroove 1.2.8-dev.d3ccf99 → 1.2.8-dev.dc83e5f

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