disgroove 1.2.9-dev.e013266 → 1.3.0-dev.d1b8866

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 (66) hide show
  1. package/dist/Client.d.ts +36 -36
  2. package/dist/Client.js +75 -75
  3. package/dist/Client.js.map +1 -1
  4. package/dist/constants.d.ts +1 -0
  5. package/dist/constants.js +1 -0
  6. package/dist/constants.js.map +1 -1
  7. package/dist/rest/RequestsManager.js +1 -1
  8. package/dist/structures/Application.d.ts +67 -67
  9. package/dist/structures/Application.js +149 -149
  10. package/dist/structures/Application.js.map +1 -1
  11. package/dist/structures/ApplicationCommand.d.ts +4 -4
  12. package/dist/structures/ApplicationCommand.js +18 -18
  13. package/dist/structures/ApplicationCommand.js.map +1 -1
  14. package/dist/structures/AutoModerationRule.d.ts +2 -2
  15. package/dist/structures/AutoModerationRule.js +6 -6
  16. package/dist/structures/AutoModerationRule.js.map +1 -1
  17. package/dist/structures/Channel.d.ts +126 -126
  18. package/dist/structures/Channel.js +255 -255
  19. package/dist/structures/Channel.js.map +1 -1
  20. package/dist/structures/Emoji.d.ts +2 -2
  21. package/dist/structures/Emoji.js +8 -8
  22. package/dist/structures/Emoji.js.map +1 -1
  23. package/dist/structures/Guild.d.ts +305 -305
  24. package/dist/structures/Guild.js +610 -609
  25. package/dist/structures/Guild.js.map +1 -1
  26. package/dist/structures/GuildMember.d.ts +9 -9
  27. package/dist/structures/GuildMember.js +30 -30
  28. package/dist/structures/GuildMember.js.map +1 -1
  29. package/dist/structures/GuildScheduledEvent.d.ts +2 -2
  30. package/dist/structures/GuildScheduledEvent.js +4 -4
  31. package/dist/structures/GuildScheduledEvent.js.map +1 -1
  32. package/dist/structures/GuildTemplate.d.ts +4 -4
  33. package/dist/structures/GuildTemplate.js +8 -8
  34. package/dist/structures/GuildTemplate.js.map +1 -1
  35. package/dist/structures/Interaction.d.ts +24 -24
  36. package/dist/structures/Interaction.js +49 -49
  37. package/dist/structures/Interaction.js.map +1 -1
  38. package/dist/structures/Message.d.ts +17 -14
  39. package/dist/structures/Message.js +32 -29
  40. package/dist/structures/Message.js.map +1 -1
  41. package/dist/structures/PartialApplication.d.ts +67 -67
  42. package/dist/structures/PartialApplication.js +149 -149
  43. package/dist/structures/PartialApplication.js.map +1 -1
  44. package/dist/structures/Role.d.ts +2 -2
  45. package/dist/structures/Role.js +6 -6
  46. package/dist/structures/Role.js.map +1 -1
  47. package/dist/structures/StageInstance.d.ts +2 -2
  48. package/dist/structures/StageInstance.js +6 -6
  49. package/dist/structures/StageInstance.js.map +1 -1
  50. package/dist/structures/Sticker.d.ts +2 -2
  51. package/dist/structures/Sticker.js +8 -8
  52. package/dist/structures/Sticker.js.map +1 -1
  53. package/dist/structures/UnavailableGuild.d.ts +305 -305
  54. package/dist/structures/UnavailableGuild.js +609 -609
  55. package/dist/structures/UnavailableGuild.js.map +1 -1
  56. package/dist/structures/User.d.ts +11 -11
  57. package/dist/structures/User.js +34 -33
  58. package/dist/structures/User.js.map +1 -1
  59. package/dist/structures/Webhook.d.ts +23 -23
  60. package/dist/structures/Webhook.js +65 -65
  61. package/dist/structures/Webhook.js.map +1 -1
  62. package/dist/types/message-components.d.ts +4 -4
  63. package/dist/utils/Util.d.ts +8 -482
  64. package/dist/utils/Util.js +169 -150
  65. package/dist/utils/Util.js.map +1 -1
  66. package/package.json +2 -2
@@ -187,133 +187,58 @@ class Guild extends _1.Base {
187
187
  if (data.guild_scheduled_events !== undefined)
188
188
  this.guildScheduledEvents = data.guild_scheduled_events.map((guildScheduledEvent) => new _1.GuildScheduledEvent(guildScheduledEvent, this.client));
189
189
  }
190
- /** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands */
191
- async getApplicationCommands(applicationId, options) {
190
+ /** https://discord.com/developers/docs/resources/guild#add-guild-member */
191
+ async addMember(userId, options) {
192
192
  return this.client.rest
193
- .get(rest_1.Endpoints.applicationGuildCommands(applicationId, this.id), {
194
- query: {
195
- with_localizations: options?.withLocalizations,
193
+ .put(rest_1.Endpoints.guildMember(this.id, userId), {
194
+ json: {
195
+ access_token: options.accessToken,
196
+ nick: options.nick,
197
+ roles: options.roles,
198
+ mute: options.mute,
199
+ deaf: options.deaf,
196
200
  },
197
201
  })
198
- .then((response) => response.map((data) => new _1.ApplicationCommand(data, this.client)));
199
- }
200
- /** https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command */
201
- async createApplicationCommand(applicationId, options) {
202
- return new _1.ApplicationCommand(await this.client.rest.post(rest_1.Endpoints.applicationGuildCommands(applicationId, this.id), {
203
- json: this.client.util.applicationCommandToRaw(options),
204
- }), this.client);
205
- }
206
- /** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command */
207
- async getApplicationCommand(applicationId, commandId) {
208
- return new _1.ApplicationCommand(await this.client.rest.get(rest_1.Endpoints.applicationGuildCommand(applicationId, this.id, commandId)), this.client);
209
- }
210
- /** https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command */
211
- async editApplicationCommand(applicationId, commandId, options) {
212
- return new _1.ApplicationCommand(await this.client.rest.patch(rest_1.Endpoints.applicationGuildCommand(applicationId, this.id, commandId), {
213
- json: this.client.util.applicationCommandToRaw(options),
214
- }), this.client);
202
+ .then((response) => {
203
+ if (response !== null) {
204
+ return new _1.GuildMember(response, this.client);
205
+ }
206
+ else {
207
+ return null;
208
+ }
209
+ });
215
210
  }
216
- /** https://discord.com/developers/docs/interactions/application-commands#delete-guild-application-command */
217
- deleteApplicationCommand(applicationId, commandId) {
218
- this.client.rest.delete(rest_1.Endpoints.applicationGuildCommand(applicationId, this.id, commandId));
211
+ /** https://discord.com/developers/docs/resources/guild#add-guild-member-role */
212
+ addMemberRole(userId, roleId, reason) {
213
+ this.client.rest.put(rest_1.Endpoints.guildMemberRole(this.id, userId, roleId), {
214
+ reason,
215
+ });
219
216
  }
220
217
  /** https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands */
221
- async bulkOverwriteApplicationCommands(applicationId, commands) {
218
+ async bulkEditApplicationCommands(applicationId, commands) {
222
219
  return this.client.rest
223
220
  .put(rest_1.Endpoints.applicationGuildCommands(applicationId, this.id), {
224
221
  json: commands.map((command) => this.client.util.applicationCommandToRaw(command)),
225
222
  })
226
223
  .then((response) => response.map((data) => new _1.ApplicationCommand(data, this.client)));
227
224
  }
228
- /** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions */
229
- async getApplicationCommandsPermissions(applicationId) {
230
- return this.client.rest
231
- .get(rest_1.Endpoints.guildApplicationCommandsPermissions(applicationId, this.id))
232
- .then((response) => response.map((permissions) => ({
233
- id: permissions.id,
234
- applicationId: permissions.application_id,
235
- guildId: permissions.guild_id,
236
- permissions: permissions.permissions.map((permission) => ({
237
- id: permission.id,
238
- type: permission.type,
239
- permission: permission.permission,
240
- })),
241
- })));
242
- }
243
- /** https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions */
244
- async getApplicationCommandPermissions(applicationId, commandId) {
245
- return this.client.rest
246
- .get(rest_1.Endpoints.applicationCommandPermissions(applicationId, this.id, commandId))
247
- .then((response) => response.map((permissions) => ({
248
- id: permissions.id,
249
- applicationId: permissions.application_id,
250
- guildId: permissions.guild_id,
251
- permissions: permissions.permissions.map((permission) => ({
252
- id: permission.id,
253
- type: permission.type,
254
- permission: permission.permission,
255
- })),
256
- })));
257
- }
258
- /** https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log */
259
- async getAuditLog(options) {
260
- return this.client.rest
261
- .get(rest_1.Endpoints.guildAuditLog(this.id), {
262
- query: {
263
- user_id: options?.userId,
264
- action_type: options?.actionType,
265
- before: options?.before,
266
- after: options?.after,
267
- limit: options?.limit,
225
+ /** https://discord.com/developers/docs/resources/guild#begin-guild-prune */
226
+ async beginGuildPrune(options, reason) {
227
+ return this.client.rest.post(rest_1.Endpoints.guildPrune(this.id), {
228
+ json: {
229
+ days: options.days,
230
+ compute_prune_count: options.computePruneCount,
231
+ include_roles: options.includeRoles,
232
+ reason: options.reason,
268
233
  },
269
- })
270
- .then((response) => ({
271
- applicationCommands: response.application_commands.map((applicationCommand) => new _1.ApplicationCommand(applicationCommand, this.client)),
272
- auditLogEntries: response.audit_log_entries.map((auditLogEntry) => ({
273
- targetId: auditLogEntry.target_id,
274
- changes: auditLogEntry.changes?.map((change) => ({
275
- newValue: change.new_value,
276
- oldValue: change.old_value,
277
- key: change.key,
278
- })),
279
- userId: auditLogEntry.user_id,
280
- id: auditLogEntry.id,
281
- actionType: auditLogEntry.action_type,
282
- options: auditLogEntry.options !== undefined
283
- ? {
284
- applicationId: auditLogEntry.options.application_id,
285
- autoModerationRuleName: auditLogEntry.options.auto_moderation_rule_name,
286
- autoModerationRuleTriggerType: auditLogEntry.options.auto_moderation_rule_trigger_type,
287
- channelId: auditLogEntry.options.channel_id,
288
- count: auditLogEntry.options.count,
289
- deleteMemberDays: auditLogEntry.options.delete_member_days,
290
- id: auditLogEntry.options.id,
291
- membersRemoved: auditLogEntry.options.members_removed,
292
- messageId: auditLogEntry.options.message_id,
293
- roleName: auditLogEntry.options.role_name,
294
- type: auditLogEntry.options.type,
295
- integrationType: auditLogEntry.options.integration_type,
296
- }
297
- : undefined,
298
- reason: auditLogEntry.reason,
299
- })),
300
- autoModerationRules: response.auto_moderation_rules.map((autoModerationRule) => new _1.AutoModerationRule(autoModerationRule, this.client)),
301
- guildScheduledEvents: response.guild_scheduled_events.map((guildScheduledEvent) => new _1.GuildScheduledEvent(guildScheduledEvent, this.client)),
302
- integrations: response.integrations.map((integration) => new _1.Integration(integration, this.client)),
303
- threads: response.threads.map((thread) => new _1.Channel(thread, this.client)),
304
- users: response.users.map((user) => new _1.User(user, this.client)),
305
- webhooks: response.webhooks.map((webhook) => new _1.Webhook(webhook, this.client)),
306
- }));
307
- }
308
- /** https://discord.com/developers/docs/resources/auto-moderation#list-auto-moderation-rules-for-guild */
309
- async getAutoModerationRules() {
310
- return this.client.rest
311
- .get(rest_1.Endpoints.guildAutoModerationRules(this.id))
312
- .then((response) => response.map((data) => new _1.AutoModerationRule(data, this.client)));
234
+ reason,
235
+ });
313
236
  }
314
- /** https://discord.com/developers/docs/resources/auto-moderation#get-auto-moderation-rule */
315
- async getAutoModerationRule(ruleId) {
316
- return new _1.AutoModerationRule(await this.client.rest.get(rest_1.Endpoints.guildAutoModerationRule(this.id, ruleId)), this.client);
237
+ /** https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command */
238
+ async createApplicationCommand(applicationId, options) {
239
+ return new _1.ApplicationCommand(await this.client.rest.post(rest_1.Endpoints.applicationGuildCommands(applicationId, this.id), {
240
+ json: this.client.util.applicationCommandToRaw(options),
241
+ }), this.client);
317
242
  }
318
243
  /** https://discord.com/developers/docs/resources/auto-moderation#create-auto-moderation-rule */
319
244
  async createAutoModerationRule(options, reason) {
@@ -338,44 +263,44 @@ class Guild extends _1.Base {
338
263
  reason,
339
264
  }), this.client);
340
265
  }
341
- /** https://discord.com/developers/docs/resources/auto-moderation#modify-auto-moderation-rule */
342
- async editAutoModerationRule(ruleId, options, reason) {
343
- return new _1.AutoModerationRule(await this.client.rest.patch(rest_1.Endpoints.guildAutoModerationRule(this.id, ruleId), {
266
+ /** https://discord.com/developers/docs/resources/guild#create-guild-ban */
267
+ createBan(userId, options, reason) {
268
+ this.client.rest.put(rest_1.Endpoints.guildBan(this.id, userId), {
344
269
  json: {
345
- name: options.name,
346
- event_type: options.eventType,
347
- trigger_type: options.triggerType,
348
- trigger_metadata: options.triggerMetadata,
349
- actions: options.actions?.map((action) => ({
350
- type: action.type,
351
- metadata: {
352
- channel_id: action.metadata.channelId,
353
- duration_seconds: action.metadata.durationSeconds,
354
- custom_message: action.metadata.customMessage,
355
- },
356
- })),
357
- enabled: options.enabled,
358
- exempt_roles: options.exemptRoles,
359
- exempt_channels: options.exemptChannels,
270
+ delete_message_days: options?.deleteMessageDays,
271
+ delete_message_seconds: options?.deleteMessageSeconds,
360
272
  },
361
273
  reason,
362
- }), this.client);
363
- }
364
- /** https://discord.com/developers/docs/resources/auto-moderation#delete-auto-moderation-rule */
365
- deleteAutoModerationRule(ruleId, reason) {
366
- this.client.rest.delete(rest_1.Endpoints.guildAutoModerationRule(this.id, ruleId), {
367
- reason,
368
274
  });
369
275
  }
370
- /** https://discord.com/developers/docs/resources/emoji#list-guild-emojis */
371
- async getEmojis() {
372
- return this.client.rest
373
- .get(rest_1.Endpoints.guildEmojis(this.id))
374
- .then((response) => response.map((data) => new _1.Emoji(data, this.client)));
375
- }
376
- /** https://discord.com/developers/docs/resources/emoji#get-guild-emoji */
377
- async getEmoji(emojiId) {
378
- return new _1.Emoji(await this.client.rest.get(rest_1.Endpoints.guildEmoji(this.id, emojiId)), this.client);
276
+ /** https://discord.com/developers/docs/resources/guild#create-guild-channel */
277
+ async createChannel(options, reason) {
278
+ return new _1.Channel(await this.client.rest.post(rest_1.Endpoints.guildChannels(this.id), {
279
+ json: {
280
+ name: options.name,
281
+ type: options.type,
282
+ topic: options.topic,
283
+ bitrate: options.bitrate,
284
+ user_limit: options.userLimit,
285
+ rate_limit_per_user: options.rateLimitPerUser,
286
+ position: options.position,
287
+ permission_overwrites: options.permissionOverwrites,
288
+ parent_id: options.parentId,
289
+ nsfw: options.nsfw,
290
+ rtc_region: options.rtcRegion,
291
+ video_quality_mode: options.videoQualityMode,
292
+ default_auto_archive_duration: options.defaultAutoArchiveDuration,
293
+ default_reaction_emoji: {
294
+ emojiId: options.defaultReactionEmoji?.emojiId,
295
+ emojiName: options.defaultReactionEmoji?.emojiName,
296
+ },
297
+ available_tags: options.availableTags,
298
+ default_sort_order: options.defaultSortOrder,
299
+ default_forum_layout: options.defaultForumLayout,
300
+ default_thread_rate_limit_per_user: options.defaultThreadRateLimitPerUser,
301
+ },
302
+ reason,
303
+ }), this.client);
379
304
  }
380
305
  /** https://discord.com/developers/docs/resources/emoji#create-guild-emoji */
381
306
  async createEmoji(options, reason) {
@@ -388,54 +313,108 @@ class Guild extends _1.Base {
388
313
  reason,
389
314
  }), this.client);
390
315
  }
391
- /** https://discord.com/developers/docs/resources/emoji#modify-guild-emoji */
392
- async editEmoji(emojiId, options, reason) {
393
- return new _1.Emoji(await this.client.rest.patch(rest_1.Endpoints.guildEmoji(this.id, emojiId), {
316
+ /** https://discord.com/developers/docs/resources/guild#create-guild-role */
317
+ async createRole(options, reason) {
318
+ return new _1.Role(await this.client.rest.post(rest_1.Endpoints.guildRoles(this.id), {
394
319
  json: {
395
320
  name: options.name,
396
- roles: options.roles,
321
+ permissions: options.permissions,
322
+ color: options.color,
323
+ hoist: options.hoist,
324
+ icon: options.icon,
325
+ unicode_emoji: options.unicodeEmoji,
326
+ mentionable: options.mentionable,
397
327
  },
398
328
  reason,
399
329
  }), this.client);
400
330
  }
401
- /** https://discord.com/developers/docs/resources/emoji#delete-guild-emoji */
402
- deleteEmoji(emojiId, reason) {
403
- this.client.rest.delete(rest_1.Endpoints.guildEmoji(this.id, emojiId), {
331
+ /** https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event */
332
+ async createScheduledEvent(options, reason) {
333
+ return new _1.GuildScheduledEvent(await this.client.rest.post(rest_1.Endpoints.guildScheduledEvents(this.id), {
334
+ json: {
335
+ channel_id: options.channelId,
336
+ entity_metadata: options.entityMetadata,
337
+ name: options.name,
338
+ privacy_level: options.privacyLevel,
339
+ scheduled_start_time: options.scheduledEndTime,
340
+ scheduled_end_time: options.scheduledEndTime,
341
+ description: options.description,
342
+ entity_type: options.entityType,
343
+ image: options.image,
344
+ },
404
345
  reason,
405
- });
346
+ }), this.client);
406
347
  }
407
- /** https://discord.com/developers/docs/resources/guild#get-guild-preview */
408
- async getPreview() {
348
+ /** https://discord.com/developers/docs/resources/sticker#create-guild-sticker */
349
+ async createSticker(options, reason) {
350
+ const formData = new undici_1.FormData();
351
+ formData.set("name", options.name);
352
+ formData.set("description", options.description);
353
+ formData.set("tags", options.tags);
354
+ formData.set("file", new undici_1.File([options.file.contents], options.file.name));
409
355
  return this.client.rest
410
- .get(rest_1.Endpoints.guildPreview(this.id))
411
- .then((response) => ({
412
- id: response.id,
413
- name: response.name,
414
- icon: response.icon,
415
- splash: response.splash,
416
- discoverySplash: response.discovery_splash,
417
- emojis: response.emojis.map((emoji) => new _1.Emoji(emoji, this.client)),
418
- features: response.features,
419
- approximateMemberCount: response.approximate_member_count,
420
- approximatePresenceCount: response.approximate_presence_count,
421
- description: response.description,
422
- stickers: response.stickers?.map((sticker) => ({
423
- id: sticker.id,
424
- packId: sticker.pack_id,
425
- name: sticker.name,
426
- description: sticker.description,
427
- tags: sticker.tags,
428
- asset: sticker.asset,
429
- type: sticker.type,
430
- formatType: sticker.format_type,
431
- available: sticker.available,
432
- guildId: sticker.guild_id,
433
- user: sticker.user !== undefined
434
- ? new _1.User(sticker.user, this.client)
435
- : undefined,
436
- sortValue: sticker.sort_value,
437
- })),
438
- }));
356
+ .post(rest_1.Endpoints.guildStickers(this.id), {
357
+ form: formData,
358
+ reason,
359
+ })
360
+ .then((response) => new _1.Sticker(response, this.client));
361
+ }
362
+ /** https://discord.com/developers/docs/resources/guild-template#create-guild-template */
363
+ async createTemplate(options) {
364
+ return new _1.GuildTemplate(await this.client.rest.post(rest_1.Endpoints.guildTemplates(this.id), {
365
+ json: {
366
+ name: options.name,
367
+ description: options.description,
368
+ },
369
+ }), this.client);
370
+ }
371
+ /** https://discord.com/developers/docs/resources/guild#delete-guild */
372
+ delete() {
373
+ this.client.rest.delete(rest_1.Endpoints.guild(this.id));
374
+ }
375
+ /** https://discord.com/developers/docs/interactions/application-commands#delete-guild-application-command */
376
+ deleteApplicationCommand(applicationId, commandId) {
377
+ this.client.rest.delete(rest_1.Endpoints.applicationGuildCommand(applicationId, this.id, commandId));
378
+ }
379
+ /** https://discord.com/developers/docs/resources/auto-moderation#delete-auto-moderation-rule */
380
+ deleteAutoModerationRule(ruleId, reason) {
381
+ this.client.rest.delete(rest_1.Endpoints.guildAutoModerationRule(this.id, ruleId), {
382
+ reason,
383
+ });
384
+ }
385
+ /** https://discord.com/developers/docs/resources/emoji#delete-guild-emoji */
386
+ deleteEmoji(emojiId, reason) {
387
+ this.client.rest.delete(rest_1.Endpoints.guildEmoji(this.id, emojiId), {
388
+ reason,
389
+ });
390
+ }
391
+ /** https://discord.com/developers/docs/resources/guild#delete-guild-integration */
392
+ deleteIntegration(integrationId, reason) {
393
+ this.client.rest.delete(rest_1.Endpoints.guildIntegration(this.id, integrationId), {
394
+ reason,
395
+ });
396
+ }
397
+ /** https://discord.com/developers/docs/resources/guild#delete-guild-role */
398
+ deleteRole(roleId, reason) {
399
+ this.client.rest.delete(rest_1.Endpoints.guildRole(this.id, roleId), {
400
+ reason,
401
+ });
402
+ }
403
+ /** https://discord.com/developers/docs/resources/guild-scheduled-event#delete-guild-scheduled-event */
404
+ deleteScheduledEvent(scheduledEventId) {
405
+ this.client.rest.delete(rest_1.Endpoints.guildScheduledEvent(this.id, scheduledEventId));
406
+ }
407
+ /** https://discord.com/developers/docs/resources/sticker#delete-guild-sticker */
408
+ deleteSticker(stickerId, reason) {
409
+ this.client.rest.delete(rest_1.Endpoints.guildSticker(this.id, stickerId), {
410
+ reason,
411
+ });
412
+ }
413
+ /** https://discord.com/developers/docs/resources/guild-template#delete-guild-template */
414
+ async deleteTemplate(code) {
415
+ return this.client.rest
416
+ .delete(rest_1.Endpoints.guildTemplate(this.id, code))
417
+ .then((response) => new _1.GuildTemplate(response, this.client).toJSON());
439
418
  }
440
419
  /** https://discord.com/developers/docs/resources/guild#modify-guild */
441
420
  async edit(options, reason) {
@@ -466,41 +445,31 @@ class Guild extends _1.Base {
466
445
  reason,
467
446
  }), this.client);
468
447
  }
469
- /** https://discord.com/developers/docs/resources/guild#delete-guild */
470
- delete() {
471
- this.client.rest.delete(rest_1.Endpoints.guild(this.id));
472
- }
473
- /** https://discord.com/developers/docs/resources/guild#get-guild-channels */
474
- async getChannels() {
475
- return this.client.rest
476
- .get(rest_1.Endpoints.guildChannels(this.id))
477
- .then((response) => response.map((data) => new _1.Channel(data, this.client)));
448
+ /** https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command */
449
+ async editApplicationCommand(applicationId, commandId, options) {
450
+ return new _1.ApplicationCommand(await this.client.rest.patch(rest_1.Endpoints.applicationGuildCommand(applicationId, this.id, commandId), {
451
+ json: this.client.util.applicationCommandToRaw(options),
452
+ }), this.client);
478
453
  }
479
- /** https://discord.com/developers/docs/resources/guild#create-guild-channel */
480
- async createChannel(options, reason) {
481
- return new _1.Channel(await this.client.rest.post(rest_1.Endpoints.guildChannels(this.id), {
454
+ /** https://discord.com/developers/docs/resources/auto-moderation#modify-auto-moderation-rule */
455
+ async editAutoModerationRule(ruleId, options, reason) {
456
+ return new _1.AutoModerationRule(await this.client.rest.patch(rest_1.Endpoints.guildAutoModerationRule(this.id, ruleId), {
482
457
  json: {
483
458
  name: options.name,
484
- type: options.type,
485
- topic: options.topic,
486
- bitrate: options.bitrate,
487
- user_limit: options.userLimit,
488
- rate_limit_per_user: options.rateLimitPerUser,
489
- position: options.position,
490
- permission_overwrites: options.permissionOverwrites,
491
- parent_id: options.parentId,
492
- nsfw: options.nsfw,
493
- rtc_region: options.rtcRegion,
494
- video_quality_mode: options.videoQualityMode,
495
- default_auto_archive_duration: options.defaultAutoArchiveDuration,
496
- default_reaction_emoji: {
497
- emojiId: options.defaultReactionEmoji?.emojiId,
498
- emojiName: options.defaultReactionEmoji?.emojiName,
499
- },
500
- available_tags: options.availableTags,
501
- default_sort_order: options.defaultSortOrder,
502
- default_forum_layout: options.defaultForumLayout,
503
- default_thread_rate_limit_per_user: options.defaultThreadRateLimitPerUser,
459
+ event_type: options.eventType,
460
+ trigger_type: options.triggerType,
461
+ trigger_metadata: options.triggerMetadata,
462
+ actions: options.actions?.map((action) => ({
463
+ type: action.type,
464
+ metadata: {
465
+ channel_id: action.metadata.channelId,
466
+ duration_seconds: action.metadata.durationSeconds,
467
+ custom_message: action.metadata.customMessage,
468
+ },
469
+ })),
470
+ enabled: options.enabled,
471
+ exempt_roles: options.exemptRoles,
472
+ exempt_channels: options.exemptChannels,
504
473
  },
505
474
  reason,
506
475
  }), this.client);
@@ -516,64 +485,34 @@ class Guild extends _1.Base {
516
485
  })),
517
486
  });
518
487
  }
519
- /** https://discord.com/developers/docs/resources/guild#list-active-guild-threads */
520
- async getActiveThreads() {
521
- return this.client.rest
522
- .get(rest_1.Endpoints.guildActiveThreads(this.id))
523
- .then((response) => response.map((data) => ({
524
- threads: data.threads.map((data) => new _1.Channel(data, this.client)),
525
- members: data.members.map((data) => ({
526
- id: data.id,
527
- userId: data.user_id,
528
- joinTimestamp: data.join_timestamp,
529
- flags: data.flags,
530
- member: data.member !== undefined
531
- ? new _1.GuildMember(data.member, this.client)
532
- : undefined,
533
- })),
534
- })));
535
- }
536
- /** https://discord.com/developers/docs/resources/guild#get-guild-member */
537
- async getMember(userId) {
538
- return new _1.GuildMember(await this.client.rest.get(rest_1.Endpoints.guildMember(this.id, userId)), this.client);
539
- }
540
- /** https://discord.com/developers/docs/resources/guild#list-guild-members */
541
- async getMembers() {
542
- return this.client.rest
543
- .get(rest_1.Endpoints.guildMembers(this.id))
544
- .then((response) => response.map((data) => new _1.GuildMember(data, this.client)));
488
+ /** https://discord.com/developers/docs/resources/guild#modify-current-member */
489
+ async editCurrentMember(options, reason) {
490
+ return new _1.GuildMember(await this.client.rest.patch(rest_1.Endpoints.guildMember(this.id), {
491
+ json: {
492
+ nick: options.nick,
493
+ },
494
+ reason,
495
+ }), this.client);
545
496
  }
546
- /** https://discord.com/developers/docs/resources/guild#search-guild-members */
547
- async searchMembers(options) {
548
- return this.client.rest
549
- .get(rest_1.Endpoints.guildMembersSearch(this.id), {
550
- query: {
551
- query: options.query,
552
- limit: options.limit,
497
+ /** https://discord.com/developers/docs/resources/guild#modify-current-user-voice-state */
498
+ editCurrentUserVoiceState(options) {
499
+ this.client.rest.patch(rest_1.Endpoints.guildVoiceState(this.id), {
500
+ json: {
501
+ channel_id: options.channelId,
502
+ suppress: options.suppress,
503
+ requestToSpeakTimestamp: options.requestToSpeakTimestamp,
553
504
  },
554
- })
555
- .then((response) => response.map((data) => new _1.GuildMember(data, this.client)));
505
+ });
556
506
  }
557
- /** https://discord.com/developers/docs/resources/guild#add-guild-member */
558
- async addMember(userId, options) {
559
- return this.client.rest
560
- .put(rest_1.Endpoints.guildMember(this.id, userId), {
507
+ /** https://discord.com/developers/docs/resources/emoji#modify-guild-emoji */
508
+ async editEmoji(emojiId, options, reason) {
509
+ return new _1.Emoji(await this.client.rest.patch(rest_1.Endpoints.guildEmoji(this.id, emojiId), {
561
510
  json: {
562
- access_token: options.accessToken,
563
- nick: options.nick,
511
+ name: options.name,
564
512
  roles: options.roles,
565
- mute: options.mute,
566
- deaf: options.deaf,
567
513
  },
568
- })
569
- .then((response) => {
570
- if (response !== null) {
571
- return new _1.GuildMember(response, this.client);
572
- }
573
- else {
574
- return null;
575
- }
576
- });
514
+ reason,
515
+ }), this.client);
577
516
  }
578
517
  /** https://discord.com/developers/docs/resources/guild#modify-guild-member */
579
518
  async editMember(userId, options, reason) {
@@ -590,90 +529,64 @@ class Guild extends _1.Base {
590
529
  reason,
591
530
  }), this.client);
592
531
  }
593
- /** https://discord.com/developers/docs/resources/guild#modify-current-member */
594
- async editCurrentMember(options, reason) {
595
- return new _1.GuildMember(await this.client.rest.patch(rest_1.Endpoints.guildMember(this.id), {
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), {
596
535
  json: {
597
- nick: options.nick,
536
+ level: options.level,
598
537
  },
599
538
  reason,
600
- }), this.client);
601
- }
602
- /** https://discord.com/developers/docs/resources/guild#add-guild-member-role */
603
- addMemberRole(userId, roleId, reason) {
604
- this.client.rest.put(rest_1.Endpoints.guildMemberRole(this.id, userId, roleId), {
605
- reason,
606
- });
607
- }
608
- /** https://discord.com/developers/docs/resources/guild#remove-guild-member-role */
609
- removeMemberRole(userId, roleId, reason) {
610
- this.client.rest.delete(rest_1.Endpoints.guildMemberRole(this.id, userId, roleId), {
611
- reason,
612
- });
613
- }
614
- /** https://discord.com/developers/docs/resources/guild#remove-guild-member-role */
615
- removeMember(userId, reason) {
616
- this.client.rest.delete(rest_1.Endpoints.guildMember(this.id, userId), {
617
- reason,
618
539
  });
619
540
  }
620
- /** https://discord.com/developers/docs/resources/guild#get-guild-bans */
621
- async getBans(options) {
622
- return this.client.rest
623
- .get(rest_1.Endpoints.guildBans(this.id), {
624
- query: {
625
- limit: options?.limit,
626
- before: options?.before,
627
- after: options?.after,
628
- },
629
- })
630
- .then((response) => response.map((data) => ({
631
- reason: data.reason,
632
- user: new _1.User(data.user, this.client),
633
- })));
634
- }
635
- /** https://discord.com/developers/docs/resources/guild#get-guild-ban */
636
- async getBan(userId) {
637
- return this.client.rest
638
- .get(rest_1.Endpoints.guildBan(this.id, userId))
639
- .then((response) => ({
640
- reason: response.reason,
641
- user: new _1.User(response.user, this.client),
642
- }));
643
- }
644
- /** https://discord.com/developers/docs/resources/guild#create-guild-ban */
645
- createBan(userId, options, reason) {
646
- this.client.rest.put(rest_1.Endpoints.guildBan(this.id, userId), {
541
+ /** https://discord.com/developers/docs/resources/guild#modify-guild-onboarding */
542
+ editOnboarding(options, reason) {
543
+ this.client.rest.patch(rest_1.Endpoints.guildOnboarding(this.id), {
647
544
  json: {
648
- delete_message_days: options?.deleteMessageDays,
649
- delete_message_seconds: options?.deleteMessageSeconds,
545
+ prompts: options.prompts.map((prompt) => ({
546
+ id: prompt.id,
547
+ type: prompt.type,
548
+ options: prompt.options.map((option) => ({
549
+ id: option.id,
550
+ channel_ids: option.channelIds,
551
+ role_ids: option.roleIds,
552
+ emoji: option.emoji !== undefined
553
+ ? {
554
+ id: option.emoji.id,
555
+ name: option.emoji.name,
556
+ roles: option.emoji.roles,
557
+ user: option.emoji.user,
558
+ require_colons: option.emoji.requireColons,
559
+ managed: option.emoji.managed,
560
+ animated: option.emoji.animated,
561
+ available: option.emoji.available,
562
+ }
563
+ : undefined,
564
+ emoji_id: option.emojiId,
565
+ emoji_name: option.emojiName,
566
+ emoji_animated: option.emojiAnimated,
567
+ title: option.title,
568
+ description: option.description,
569
+ })),
570
+ title: prompt.title,
571
+ single_select: prompt.singleSelect,
572
+ required: prompt.required,
573
+ in_onboarding: prompt.inOnboarding,
574
+ })),
650
575
  },
651
576
  reason,
652
577
  });
653
578
  }
654
- /** https://discord.com/developers/docs/resources/guild#remove-guild-ban */
655
- removeBan(userId, reason) {
656
- this.client.rest.delete(rest_1.Endpoints.guildBan(this.id, userId), {
657
- reason,
658
- });
659
- }
660
- /** https://discord.com/developers/docs/resources/guild#get-guild-roles */
661
- async getRoles() {
662
- return this.client.rest
663
- .get(rest_1.Endpoints.guildRoles(this.id))
664
- .then((response) => response.map((data) => new _1.Role(data, this.client)));
665
- }
666
- /** https://discord.com/developers/docs/resources/guild#create-guild-role */
667
- async createRole(options, reason) {
668
- return new _1.Role(await this.client.rest.post(rest_1.Endpoints.guildRoles(this.id), {
579
+ /** https://discord.com/developers/docs/resources/guild#modify-guild-role */
580
+ async editRole(roleId, options, reason) {
581
+ return new _1.Role(await this.client.rest.patch(rest_1.Endpoints.guildRole(this.id, roleId), {
669
582
  json: {
670
- name: options.name,
671
- permissions: options.permissions,
672
- color: options.color,
673
- hoist: options.hoist,
674
- icon: options.icon,
675
- unicode_emoji: options.unicodeEmoji,
676
- mentionable: options.mentionable,
583
+ name: options?.name,
584
+ permissions: options?.permissions,
585
+ color: options?.color,
586
+ hoist: options?.hoist,
587
+ icon: options?.icon,
588
+ unicode_emoji: options?.unicodeEmoji,
589
+ mentionable: options?.mentionable,
677
590
  },
678
591
  reason,
679
592
  }), this.client);
@@ -689,94 +602,75 @@ class Guild extends _1.Base {
689
602
  })
690
603
  .then((response) => response.map((data) => new _1.Role(data, this.client)));
691
604
  }
692
- /** https://discord.com/developers/docs/resources/guild#modify-guild-role */
693
- async editRole(roleId, options, reason) {
694
- return new _1.Role(await this.client.rest.patch(rest_1.Endpoints.guildRole(this.id, roleId), {
605
+ /** https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event */
606
+ async editScheduledEvent(scheduledEventId, options, reason) {
607
+ return new _1.GuildScheduledEvent(await this.client.rest.patch(rest_1.Endpoints.guildScheduledEvent(this.id, scheduledEventId), {
695
608
  json: {
696
- name: options?.name,
697
- permissions: options?.permissions,
698
- color: options?.color,
699
- hoist: options?.hoist,
700
- icon: options?.icon,
701
- unicode_emoji: options?.unicodeEmoji,
702
- mentionable: options?.mentionable,
609
+ channel_id: options.channelId,
610
+ entity_metadata: options.entityMetadata,
611
+ name: options.name,
612
+ privacy_level: options.privacyLevel,
613
+ scheduled_start_time: options.scheduledStartTime,
614
+ scheduled_end_time: options.scheduledEndTime,
615
+ description: options.description,
616
+ entityType: options.entityType,
617
+ status: options.status,
618
+ image: options.image,
703
619
  },
704
620
  reason,
705
621
  }), this.client);
706
622
  }
707
- /** https://discord.com/developers/docs/resources/guild#modify-guild-mfa-level */
708
- async editMFALevel(options, reason) {
709
- return this.client.rest.post(rest_1.Endpoints.guildMFA(this.id), {
623
+ /** https://discord.com/developers/docs/resources/sticker#modify-guild-sticker */
624
+ async editSticker(stickerId, options, reason) {
625
+ return this.client.rest
626
+ .patch(rest_1.Endpoints.guildSticker(this.id, stickerId), {
710
627
  json: {
711
- level: options.level,
628
+ name: options.name,
629
+ description: options.description,
630
+ tags: options.tags,
712
631
  },
713
632
  reason,
714
- });
715
- }
716
- /** https://discord.com/developers/docs/resources/guild#delete-guild-role */
717
- deleteRole(roleId, reason) {
718
- this.client.rest.delete(rest_1.Endpoints.guildRole(this.id, roleId), {
719
- reason,
720
- });
633
+ })
634
+ .then((response) => new _1.Sticker(response, this.client));
721
635
  }
722
- /** https://discord.com/developers/docs/resources/guild#get-guild-prune-count */
723
- async getPruneCount(options) {
724
- return this.client.rest.get(rest_1.Endpoints.guildPrune(this.id), {
725
- query: {
726
- days: options.days,
727
- include_roles: options.includeRoles,
636
+ /** https://discord.com/developers/docs/resources/guild-template#modify-guild-template */
637
+ async editTemplate(code, options) {
638
+ return new _1.GuildTemplate(await this.client.rest.patch(rest_1.Endpoints.guildTemplate(this.id, code), {
639
+ json: {
640
+ name: options.name,
641
+ description: options.description,
728
642
  },
729
- });
643
+ }), this.client);
730
644
  }
731
- /** https://discord.com/developers/docs/resources/guild#begin-guild-prune */
732
- async beginGuildPrune(options, reason) {
733
- return this.client.rest.post(rest_1.Endpoints.guildPrune(this.id), {
645
+ /** https://discord.com/developers/docs/resources/guild#modify-user-voice-state */
646
+ editUserVoiceState(userId, options) {
647
+ this.client.rest.patch(rest_1.Endpoints.guildVoiceState(this.id, userId), {
734
648
  json: {
735
- days: options.days,
736
- compute_prune_count: options.computePruneCount,
737
- include_roles: options.includeRoles,
738
- reason: options.reason,
649
+ channel_id: options.channelId,
650
+ suppress: options.suppress,
651
+ requestToSpeakTimestamp: options.requestToSpeakTimestamp,
739
652
  },
740
- reason,
741
653
  });
742
654
  }
743
- /** https://discord.com/developers/docs/resources/guild#get-guild-voice-regions */
744
- async getVoiceRegions() {
745
- return this.client.rest
746
- .get(rest_1.Endpoints.guildVoiceRegions(this.id))
747
- .then((response) => response.map((data) => ({
748
- id: data.id,
749
- name: data.name,
750
- optimal: data.optimal,
751
- deprecated: data.deprecated,
752
- custom: data.custom,
753
- })));
754
- }
755
- /** https://discord.com/developers/docs/resources/guild#get-guild-invites */
756
- async getInvites() {
757
- return this.client.rest
758
- .get(rest_1.Endpoints.guildInvites(this.id))
759
- .then((response) => response.map((data) => new _1.Invite(data, this.client)));
760
- }
761
- /** https://discord.com/developers/docs/resources/guild#get-guild-integrations */
762
- async getIntegrations() {
655
+ /** https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen */
656
+ async editWelcomeScreen(options, reason) {
763
657
  return this.client.rest
764
- .get(rest_1.Endpoints.guildIntegrations(this.id))
765
- .then((response) => response.map((data) => new _1.Integration(data, this.client)));
766
- }
767
- /** https://discord.com/developers/docs/resources/guild#delete-guild-integration */
768
- deleteIntegration(integrationId, reason) {
769
- this.client.rest.delete(rest_1.Endpoints.guildIntegration(this.id, integrationId), {
658
+ .patch(rest_1.Endpoints.guildWelcomeScreen(this.id), {
659
+ json: {
660
+ enabled: options.enabled,
661
+ welcome_channels: options.welcomeChannels,
662
+ description: options.description,
663
+ },
770
664
  reason,
771
- });
772
- }
773
- /** https://discord.com/developers/docs/resources/guild#get-guild-widget-settings */
774
- async getWidgetSettings() {
775
- return this.client.rest
776
- .get(rest_1.Endpoints.guildWidgetSettings(this.id))
665
+ })
777
666
  .then((response) => ({
778
- enabled: response.enabled,
779
- channelId: response.channel_id,
667
+ description: response.description,
668
+ welcomeChannels: response.welcome_channels.map((data) => ({
669
+ channelId: data.channel_id,
670
+ description: data.description,
671
+ emojiId: data.emoji_id,
672
+ emojiName: data.emoji_name,
673
+ })),
780
674
  }));
781
675
  }
782
676
  /** https://discord.com/developers/docs/resources/guild#modify-guild-widget */
@@ -794,66 +688,189 @@ class Guild extends _1.Base {
794
688
  channelId: response.channel_id,
795
689
  }));
796
690
  }
797
- /** https://discord.com/developers/docs/resources/guild#get-guild-widget */
798
- async getWidget() {
691
+ /** https://discord.com/developers/docs/resources/guild#list-active-guild-threads */
692
+ async getActiveThreads() {
799
693
  return this.client.rest
800
- .get(rest_1.Endpoints.guildWidgetJSON(this.id))
801
- .then((response) => ({
802
- id: response.id,
803
- name: response.name,
804
- instantInvite: response.instant_invite,
805
- channels: response.channels.map((data) => new _1.Channel(data, this.client)),
806
- members: response.members.map((data) => new _1.User(data, this.client)),
807
- presenceCount: response.presence_count,
808
- }));
694
+ .get(rest_1.Endpoints.guildActiveThreads(this.id))
695
+ .then((response) => response.map((data) => ({
696
+ threads: data.threads.map((data) => new _1.Channel(data, this.client)),
697
+ members: data.members.map((data) => ({
698
+ id: data.id,
699
+ userId: data.user_id,
700
+ joinTimestamp: data.join_timestamp,
701
+ flags: data.flags,
702
+ member: data.member !== undefined
703
+ ? new _1.GuildMember(data.member, this.client)
704
+ : undefined,
705
+ })),
706
+ })));
809
707
  }
810
- /** https://discord.com/developers/docs/resources/guild#get-guild-vanity-url */
811
- getVanityURL() {
812
- return this.client.rest.get(rest_1.Endpoints.guildVanityUrl(this.id));
708
+ /** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command */
709
+ async getApplicationCommand(applicationId, commandId) {
710
+ return new _1.ApplicationCommand(await this.client.rest.get(rest_1.Endpoints.applicationGuildCommand(applicationId, this.id, commandId)), this.client);
813
711
  }
814
- /** https://discord.com/developers/docs/resources/guild#get-guild-widget-image */
815
- async getWidgetImage(options) {
816
- return this.client.rest.get(rest_1.Endpoints.guildWidgetImage(this.id), {
712
+ /** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands */
713
+ async getApplicationCommands(applicationId, options) {
714
+ return this.client.rest
715
+ .get(rest_1.Endpoints.applicationGuildCommands(applicationId, this.id), {
817
716
  query: {
818
- style: options?.style,
717
+ with_localizations: options?.withLocalizations,
819
718
  },
820
- });
719
+ })
720
+ .then((response) => response.map((data) => new _1.ApplicationCommand(data, this.client)));
821
721
  }
822
- /** https://discord.com/developers/docs/resources/guild#get-guild-welcome-screen */
823
- async getWelcomeScreen() {
722
+ /** https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions */
723
+ async getApplicationCommandPermissions(applicationId, commandId) {
824
724
  return this.client.rest
825
- .get(rest_1.Endpoints.guildWelcomeScreen(this.id))
826
- .then((response) => ({
827
- description: response.description,
828
- welcomeChannels: response.welcome_channels.map((data) => ({
829
- channelId: data.channel_id,
830
- description: data.description,
831
- emojiId: data.emoji_id,
832
- emojiName: data.emoji_name,
725
+ .get(rest_1.Endpoints.applicationCommandPermissions(applicationId, this.id, commandId))
726
+ .then((response) => response.map((permissions) => ({
727
+ id: permissions.id,
728
+ applicationId: permissions.application_id,
729
+ guildId: permissions.guild_id,
730
+ permissions: permissions.permissions.map((permission) => ({
731
+ id: permission.id,
732
+ type: permission.type,
733
+ permission: permission.permission,
833
734
  })),
834
- }));
735
+ })));
835
736
  }
836
- /** https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen */
837
- async editWelcomeScreen(options, reason) {
737
+ /** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions */
738
+ async getApplicationCommandsPermissions(applicationId) {
838
739
  return this.client.rest
839
- .patch(rest_1.Endpoints.guildWelcomeScreen(this.id), {
840
- json: {
841
- enabled: options.enabled,
842
- welcome_channels: options.welcomeChannels,
843
- description: options.description,
740
+ .get(rest_1.Endpoints.guildApplicationCommandsPermissions(applicationId, this.id))
741
+ .then((response) => response.map((permissions) => ({
742
+ id: permissions.id,
743
+ applicationId: permissions.application_id,
744
+ guildId: permissions.guild_id,
745
+ permissions: permissions.permissions.map((permission) => ({
746
+ id: permission.id,
747
+ type: permission.type,
748
+ permission: permission.permission,
749
+ })),
750
+ })));
751
+ }
752
+ /** https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log */
753
+ async getAuditLog(options) {
754
+ return this.client.rest
755
+ .get(rest_1.Endpoints.guildAuditLog(this.id), {
756
+ query: {
757
+ user_id: options?.userId,
758
+ action_type: options?.actionType,
759
+ before: options?.before,
760
+ after: options?.after,
761
+ limit: options?.limit,
844
762
  },
845
- reason,
846
763
  })
847
764
  .then((response) => ({
848
- description: response.description,
849
- welcomeChannels: response.welcome_channels.map((data) => ({
850
- channelId: data.channel_id,
851
- description: data.description,
852
- emojiId: data.emoji_id,
853
- emojiName: data.emoji_name,
765
+ applicationCommands: response.application_commands.map((applicationCommand) => new _1.ApplicationCommand(applicationCommand, this.client)),
766
+ auditLogEntries: response.audit_log_entries.map((auditLogEntry) => ({
767
+ targetId: auditLogEntry.target_id,
768
+ changes: auditLogEntry.changes?.map((change) => ({
769
+ newValue: change.new_value,
770
+ oldValue: change.old_value,
771
+ key: change.key,
772
+ })),
773
+ userId: auditLogEntry.user_id,
774
+ id: auditLogEntry.id,
775
+ actionType: auditLogEntry.action_type,
776
+ options: auditLogEntry.options !== undefined
777
+ ? {
778
+ applicationId: auditLogEntry.options.application_id,
779
+ autoModerationRuleName: auditLogEntry.options.auto_moderation_rule_name,
780
+ autoModerationRuleTriggerType: auditLogEntry.options.auto_moderation_rule_trigger_type,
781
+ channelId: auditLogEntry.options.channel_id,
782
+ count: auditLogEntry.options.count,
783
+ deleteMemberDays: auditLogEntry.options.delete_member_days,
784
+ id: auditLogEntry.options.id,
785
+ membersRemoved: auditLogEntry.options.members_removed,
786
+ messageId: auditLogEntry.options.message_id,
787
+ roleName: auditLogEntry.options.role_name,
788
+ type: auditLogEntry.options.type,
789
+ integrationType: auditLogEntry.options.integration_type,
790
+ }
791
+ : undefined,
792
+ reason: auditLogEntry.reason,
854
793
  })),
794
+ autoModerationRules: response.auto_moderation_rules.map((autoModerationRule) => new _1.AutoModerationRule(autoModerationRule, this.client)),
795
+ guildScheduledEvents: response.guild_scheduled_events.map((guildScheduledEvent) => new _1.GuildScheduledEvent(guildScheduledEvent, this.client)),
796
+ integrations: response.integrations.map((integration) => new _1.Integration(integration, this.client)),
797
+ threads: response.threads.map((thread) => new _1.Channel(thread, this.client)),
798
+ users: response.users.map((user) => new _1.User(user, this.client)),
799
+ webhooks: response.webhooks.map((webhook) => new _1.Webhook(webhook, this.client)),
800
+ }));
801
+ }
802
+ /** https://discord.com/developers/docs/resources/auto-moderation#get-auto-moderation-rule */
803
+ async getAutoModerationRule(ruleId) {
804
+ return new _1.AutoModerationRule(await this.client.rest.get(rest_1.Endpoints.guildAutoModerationRule(this.id, ruleId)), this.client);
805
+ }
806
+ /** https://discord.com/developers/docs/resources/auto-moderation#list-auto-moderation-rules-for-guild */
807
+ async getAutoModerationRules() {
808
+ return this.client.rest
809
+ .get(rest_1.Endpoints.guildAutoModerationRules(this.id))
810
+ .then((response) => response.map((data) => new _1.AutoModerationRule(data, this.client)));
811
+ }
812
+ /** https://discord.com/developers/docs/resources/guild#get-guild-ban */
813
+ async getBan(userId) {
814
+ return this.client.rest
815
+ .get(rest_1.Endpoints.guildBan(this.id, userId))
816
+ .then((response) => ({
817
+ reason: response.reason,
818
+ user: new _1.User(response.user, this.client),
855
819
  }));
856
820
  }
821
+ /** https://discord.com/developers/docs/resources/guild#get-guild-bans */
822
+ async getBans(options) {
823
+ return this.client.rest
824
+ .get(rest_1.Endpoints.guildBans(this.id), {
825
+ query: {
826
+ limit: options?.limit,
827
+ before: options?.before,
828
+ after: options?.after,
829
+ },
830
+ })
831
+ .then((response) => response.map((data) => ({
832
+ reason: data.reason,
833
+ user: new _1.User(data.user, this.client),
834
+ })));
835
+ }
836
+ /** https://discord.com/developers/docs/resources/guild#get-guild-channels */
837
+ async getChannels() {
838
+ return this.client.rest
839
+ .get(rest_1.Endpoints.guildChannels(this.id))
840
+ .then((response) => response.map((data) => new _1.Channel(data, this.client)));
841
+ }
842
+ /** https://discord.com/developers/docs/resources/emoji#get-guild-emoji */
843
+ async getEmoji(emojiId) {
844
+ return new _1.Emoji(await this.client.rest.get(rest_1.Endpoints.guildEmoji(this.id, emojiId)), this.client);
845
+ }
846
+ /** https://discord.com/developers/docs/resources/emoji#list-guild-emojis */
847
+ async getEmojis() {
848
+ return this.client.rest
849
+ .get(rest_1.Endpoints.guildEmojis(this.id))
850
+ .then((response) => response.map((data) => new _1.Emoji(data, this.client)));
851
+ }
852
+ /** https://discord.com/developers/docs/resources/guild#get-guild-integrations */
853
+ async getIntegrations() {
854
+ return this.client.rest
855
+ .get(rest_1.Endpoints.guildIntegrations(this.id))
856
+ .then((response) => response.map((data) => new _1.Integration(data, this.client)));
857
+ }
858
+ /** https://discord.com/developers/docs/resources/guild#get-guild-invites */
859
+ async getInvites() {
860
+ return this.client.rest
861
+ .get(rest_1.Endpoints.guildInvites(this.id))
862
+ .then((response) => response.map((data) => new _1.Invite(data, this.client)));
863
+ }
864
+ /** https://discord.com/developers/docs/resources/guild#get-guild-member */
865
+ async getMember(userId) {
866
+ return new _1.GuildMember(await this.client.rest.get(rest_1.Endpoints.guildMember(this.id, userId)), this.client);
867
+ }
868
+ /** https://discord.com/developers/docs/resources/guild#list-guild-members */
869
+ async getMembers() {
870
+ return this.client.rest
871
+ .get(rest_1.Endpoints.guildMembers(this.id))
872
+ .then((response) => response.map((data) => new _1.GuildMember(data, this.client)));
873
+ }
857
874
  /** https://discord.com/developers/docs/resources/guild#get-guild-onboarding */
858
875
  async getOnboarding() {
859
876
  return this.client.rest
@@ -886,63 +903,53 @@ class Guild extends _1.Base {
886
903
  mode: response.mode,
887
904
  }));
888
905
  }
889
- /** https://discord.com/developers/docs/resources/guild#modify-guild-onboarding */
890
- editOnboarding(options, reason) {
891
- this.client.rest.patch(rest_1.Endpoints.guildOnboarding(this.id), {
892
- json: {
893
- prompts: options.prompts.map((prompt) => ({
894
- id: prompt.id,
895
- type: prompt.type,
896
- options: prompt.options.map((option) => ({
897
- id: option.id,
898
- channel_ids: option.channelIds,
899
- role_ids: option.roleIds,
900
- emoji: option.emoji !== undefined
901
- ? {
902
- id: option.emoji.id,
903
- name: option.emoji.name,
904
- roles: option.emoji.roles,
905
- user: option.emoji.user,
906
- require_colons: option.emoji.requireColons,
907
- managed: option.emoji.managed,
908
- animated: option.emoji.animated,
909
- available: option.emoji.available,
910
- }
911
- : undefined,
912
- emoji_id: option.emojiId,
913
- emoji_name: option.emojiName,
914
- emoji_animated: option.emojiAnimated,
915
- title: option.title,
916
- description: option.description,
917
- })),
918
- title: prompt.title,
919
- single_select: prompt.singleSelect,
920
- required: prompt.required,
921
- in_onboarding: prompt.inOnboarding,
922
- })),
923
- },
924
- reason,
925
- });
906
+ /** https://discord.com/developers/docs/resources/guild#get-guild-preview */
907
+ async getPreview() {
908
+ return this.client.rest
909
+ .get(rest_1.Endpoints.guildPreview(this.id))
910
+ .then((response) => ({
911
+ id: response.id,
912
+ name: response.name,
913
+ icon: response.icon,
914
+ splash: response.splash,
915
+ discoverySplash: response.discovery_splash,
916
+ emojis: response.emojis.map((emoji) => new _1.Emoji(emoji, this.client)),
917
+ features: response.features,
918
+ approximateMemberCount: response.approximate_member_count,
919
+ approximatePresenceCount: response.approximate_presence_count,
920
+ description: response.description,
921
+ stickers: response.stickers?.map((sticker) => ({
922
+ id: sticker.id,
923
+ packId: sticker.pack_id,
924
+ name: sticker.name,
925
+ description: sticker.description,
926
+ tags: sticker.tags,
927
+ asset: sticker.asset,
928
+ type: sticker.type,
929
+ formatType: sticker.format_type,
930
+ available: sticker.available,
931
+ guildId: sticker.guild_id,
932
+ user: sticker.user !== undefined
933
+ ? new _1.User(sticker.user, this.client)
934
+ : undefined,
935
+ sortValue: sticker.sort_value,
936
+ })),
937
+ }));
926
938
  }
927
- /** https://discord.com/developers/docs/resources/guild#modify-current-user-voice-state */
928
- editCurrentUserVoiceState(options) {
929
- this.client.rest.patch(rest_1.Endpoints.guildVoiceState(this.id), {
930
- json: {
931
- channel_id: options.channelId,
932
- suppress: options.suppress,
933
- requestToSpeakTimestamp: options.requestToSpeakTimestamp,
939
+ /** https://discord.com/developers/docs/resources/guild#get-guild-prune-count */
940
+ async getPruneCount(options) {
941
+ return this.client.rest.get(rest_1.Endpoints.guildPrune(this.id), {
942
+ query: {
943
+ days: options.days,
944
+ include_roles: options.includeRoles,
934
945
  },
935
946
  });
936
947
  }
937
- /** https://discord.com/developers/docs/resources/guild#modify-user-voice-state */
938
- editUserVoiceState(userId, options) {
939
- this.client.rest.patch(rest_1.Endpoints.guildVoiceState(this.id, userId), {
940
- json: {
941
- channel_id: options.channelId,
942
- suppress: options.suppress,
943
- requestToSpeakTimestamp: options.requestToSpeakTimestamp,
944
- },
945
- });
948
+ /** https://discord.com/developers/docs/resources/guild#get-guild-roles */
949
+ async getRoles() {
950
+ return this.client.rest
951
+ .get(rest_1.Endpoints.guildRoles(this.id))
952
+ .then((response) => response.map((data) => new _1.Role(data, this.client)));
946
953
  }
947
954
  /** https://discord.com/developers/docs/resources/guild-scheduled-event#list-scheduled-events-for-guild */
948
955
  async getScheduledEvents(options) {
@@ -954,45 +961,6 @@ class Guild extends _1.Base {
954
961
  })
955
962
  .then((response) => response.map((data) => new _1.GuildScheduledEvent(data, this.client)));
956
963
  }
957
- /** https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event */
958
- async createScheduledEvent(options, reason) {
959
- return new _1.GuildScheduledEvent(await this.client.rest.post(rest_1.Endpoints.guildScheduledEvents(this.id), {
960
- json: {
961
- channel_id: options.channelId,
962
- entity_metadata: options.entityMetadata,
963
- name: options.name,
964
- privacy_level: options.privacyLevel,
965
- scheduled_start_time: options.scheduledEndTime,
966
- scheduled_end_time: options.scheduledEndTime,
967
- description: options.description,
968
- entity_type: options.entityType,
969
- image: options.image,
970
- },
971
- reason,
972
- }), this.client);
973
- }
974
- /** https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event */
975
- async editScheduledEvent(scheduledEventId, options, reason) {
976
- return new _1.GuildScheduledEvent(await this.client.rest.patch(rest_1.Endpoints.guildScheduledEvent(this.id, scheduledEventId), {
977
- json: {
978
- channel_id: options.channelId,
979
- entity_metadata: options.entityMetadata,
980
- name: options.name,
981
- privacy_level: options.privacyLevel,
982
- scheduled_start_time: options.scheduledStartTime,
983
- scheduled_end_time: options.scheduledEndTime,
984
- description: options.description,
985
- entityType: options.entityType,
986
- status: options.status,
987
- image: options.image,
988
- },
989
- reason,
990
- }), this.client);
991
- }
992
- /** https://discord.com/developers/docs/resources/guild-scheduled-event#delete-guild-scheduled-event */
993
- deleteScheduledEvent(scheduledEventId) {
994
- this.client.rest.delete(rest_1.Endpoints.guildScheduledEvent(this.id, scheduledEventId));
995
- }
996
964
  /** https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event-users */
997
965
  async getScheduledEventUsers(scheduledEventId, options) {
998
966
  return this.client.rest
@@ -1012,6 +980,18 @@ class Guild extends _1.Base {
1012
980
  : undefined,
1013
981
  })));
1014
982
  }
983
+ /** https://discord.com/developers/docs/resources/sticker#get-guild-sticker */
984
+ async getSticker(stickerId) {
985
+ return this.client.rest
986
+ .get(rest_1.Endpoints.guildSticker(this.id, stickerId))
987
+ .then((response) => new _1.Sticker(response, this.client));
988
+ }
989
+ /** https://discord.com/developers/docs/resources/sticker#list-guild-stickers */
990
+ async getStickers() {
991
+ return this.client.rest
992
+ .get(rest_1.Endpoints.guildStickers(this.id))
993
+ .then((response) => response.map((data) => new _1.Sticker(data, this.client)));
994
+ }
1015
995
  /** https://discord.com/developers/docs/resources/guild-template#get-guild-template */
1016
996
  async getTemplate(code) {
1017
997
  return new _1.GuildTemplate(await this.client.rest.get(rest_1.Endpoints.guildTemplate(this.id, code)), this.client);
@@ -1022,84 +1002,104 @@ class Guild extends _1.Base {
1022
1002
  .get(rest_1.Endpoints.guildTemplates(this.id))
1023
1003
  .then((response) => response.map((data) => new _1.GuildTemplate(data, this.client)));
1024
1004
  }
1025
- /** https://discord.com/developers/docs/resources/guild-template#create-guild-template */
1026
- async createTemplate(options) {
1027
- return new _1.GuildTemplate(await this.client.rest.post(rest_1.Endpoints.guildTemplates(this.id), {
1028
- json: {
1029
- name: options.name,
1030
- description: options.description,
1031
- },
1032
- }), this.client);
1033
- }
1034
- /** https://discord.com/developers/docs/resources/guild-template#sync-guild-template */
1035
- async syncTemplate(code) {
1036
- return new _1.GuildTemplate(await this.client.rest.put(rest_1.Endpoints.guildTemplate(this.id, code)), this.client);
1005
+ /** https://discord.com/developers/docs/resources/guild#get-guild-vanity-url */
1006
+ getVanityURL() {
1007
+ return this.client.rest.get(rest_1.Endpoints.guildVanityUrl(this.id));
1037
1008
  }
1038
- /** https://discord.com/developers/docs/resources/guild-template#modify-guild-template */
1039
- async editTemplate(code, options) {
1040
- return new _1.GuildTemplate(await this.client.rest.patch(rest_1.Endpoints.guildTemplate(this.id, code), {
1041
- json: {
1042
- name: options.name,
1043
- description: options.description,
1044
- },
1045
- }), this.client);
1009
+ /** https://discord.com/developers/docs/resources/guild#get-guild-voice-regions */
1010
+ async getVoiceRegions() {
1011
+ return this.client.rest
1012
+ .get(rest_1.Endpoints.guildVoiceRegions(this.id))
1013
+ .then((response) => response.map((data) => ({
1014
+ id: data.id,
1015
+ name: data.name,
1016
+ optimal: data.optimal,
1017
+ deprecated: data.deprecated,
1018
+ custom: data.custom,
1019
+ })));
1046
1020
  }
1047
- /** https://discord.com/developers/docs/resources/guild-template#delete-guild-template */
1048
- async deleteTemplate(code) {
1021
+ /** https://discord.com/developers/docs/resources/webhook#get-guild-webhooks */
1022
+ async getWebhooks() {
1049
1023
  return this.client.rest
1050
- .delete(rest_1.Endpoints.guildTemplate(this.id, code))
1051
- .then((response) => new _1.GuildTemplate(response, this.client).toJSON());
1024
+ .get(rest_1.Endpoints.guildWebhooks(this.id))
1025
+ .then((response) => response.map((data) => new _1.Webhook(data, this.client)));
1052
1026
  }
1053
- /** https://discord.com/developers/docs/resources/sticker#list-guild-stickers */
1054
- async getStickers() {
1027
+ /** https://discord.com/developers/docs/resources/guild#get-guild-welcome-screen */
1028
+ async getWelcomeScreen() {
1055
1029
  return this.client.rest
1056
- .get(rest_1.Endpoints.guildStickers(this.id))
1057
- .then((response) => response.map((data) => new _1.Sticker(data, this.client)));
1030
+ .get(rest_1.Endpoints.guildWelcomeScreen(this.id))
1031
+ .then((response) => ({
1032
+ description: response.description,
1033
+ welcomeChannels: response.welcome_channels.map((data) => ({
1034
+ channelId: data.channel_id,
1035
+ description: data.description,
1036
+ emojiId: data.emoji_id,
1037
+ emojiName: data.emoji_name,
1038
+ })),
1039
+ }));
1058
1040
  }
1059
- /** https://discord.com/developers/docs/resources/sticker#get-guild-sticker */
1060
- async getSticker(stickerId) {
1041
+ /** https://discord.com/developers/docs/resources/guild#get-guild-widget */
1042
+ async getWidget() {
1061
1043
  return this.client.rest
1062
- .get(rest_1.Endpoints.guildSticker(this.id, stickerId))
1063
- .then((response) => new _1.Sticker(response, this.client));
1044
+ .get(rest_1.Endpoints.guildWidgetJSON(this.id))
1045
+ .then((response) => ({
1046
+ id: response.id,
1047
+ name: response.name,
1048
+ instantInvite: response.instant_invite,
1049
+ channels: response.channels.map((data) => new _1.Channel(data, this.client)),
1050
+ members: response.members.map((data) => new _1.User(data, this.client)),
1051
+ presenceCount: response.presence_count,
1052
+ }));
1064
1053
  }
1065
- /** https://discord.com/developers/docs/resources/sticker#create-guild-sticker */
1066
- async createSticker(options, reason) {
1067
- const formData = new undici_1.FormData();
1068
- formData.set("name", options.name);
1069
- formData.set("description", options.description);
1070
- formData.set("tags", options.tags);
1071
- formData.set("file", new undici_1.File([options.file.contents], options.file.name));
1054
+ /** https://discord.com/developers/docs/resources/guild#get-guild-widget-image */
1055
+ async getWidgetImage(options) {
1056
+ return this.client.rest.get(rest_1.Endpoints.guildWidgetImage(this.id), {
1057
+ query: {
1058
+ style: options?.style,
1059
+ },
1060
+ });
1061
+ }
1062
+ /** https://discord.com/developers/docs/resources/guild#get-guild-widget-settings */
1063
+ async getWidgetSettings() {
1072
1064
  return this.client.rest
1073
- .post(rest_1.Endpoints.guildStickers(this.id), {
1074
- form: formData,
1065
+ .get(rest_1.Endpoints.guildWidgetSettings(this.id))
1066
+ .then((response) => ({
1067
+ enabled: response.enabled,
1068
+ channelId: response.channel_id,
1069
+ }));
1070
+ }
1071
+ /** https://discord.com/developers/docs/resources/guild#remove-guild-ban */
1072
+ removeBan(userId, reason) {
1073
+ this.client.rest.delete(rest_1.Endpoints.guildBan(this.id, userId), {
1075
1074
  reason,
1076
- })
1077
- .then((response) => new _1.Sticker(response, this.client));
1075
+ });
1078
1076
  }
1079
- /** https://discord.com/developers/docs/resources/sticker#modify-guild-sticker */
1080
- async editSticker(stickerId, options, reason) {
1081
- return this.client.rest
1082
- .patch(rest_1.Endpoints.guildSticker(this.id, stickerId), {
1083
- json: {
1084
- name: options.name,
1085
- description: options.description,
1086
- tags: options.tags,
1087
- },
1077
+ /** https://discord.com/developers/docs/resources/guild#remove-guild-member-role */
1078
+ removeMember(userId, reason) {
1079
+ this.client.rest.delete(rest_1.Endpoints.guildMember(this.id, userId), {
1088
1080
  reason,
1089
- })
1090
- .then((response) => new _1.Sticker(response, this.client));
1081
+ });
1091
1082
  }
1092
- /** https://discord.com/developers/docs/resources/sticker#delete-guild-sticker */
1093
- deleteSticker(stickerId, reason) {
1094
- this.client.rest.delete(rest_1.Endpoints.guildSticker(this.id, stickerId), {
1083
+ /** https://discord.com/developers/docs/resources/guild#remove-guild-member-role */
1084
+ removeMemberRole(userId, roleId, reason) {
1085
+ this.client.rest.delete(rest_1.Endpoints.guildMemberRole(this.id, userId, roleId), {
1095
1086
  reason,
1096
1087
  });
1097
1088
  }
1098
- /** https://discord.com/developers/docs/resources/webhook#get-guild-webhooks */
1099
- async getWebhooks() {
1089
+ /** https://discord.com/developers/docs/resources/guild#search-guild-members */
1090
+ async searchMembers(options) {
1100
1091
  return this.client.rest
1101
- .get(rest_1.Endpoints.guildWebhooks(this.id))
1102
- .then((response) => response.map((data) => new _1.Webhook(data, this.client)));
1092
+ .get(rest_1.Endpoints.guildMembersSearch(this.id), {
1093
+ query: {
1094
+ query: options.query,
1095
+ limit: options.limit,
1096
+ },
1097
+ })
1098
+ .then((response) => response.map((data) => new _1.GuildMember(data, this.client)));
1099
+ }
1100
+ /** https://discord.com/developers/docs/resources/guild-template#sync-guild-template */
1101
+ async syncTemplate(code) {
1102
+ return new _1.GuildTemplate(await this.client.rest.put(rest_1.Endpoints.guildTemplate(this.id, code)), this.client);
1103
1103
  }
1104
1104
  toRaw() {
1105
1105
  return this.raw;
@@ -1141,6 +1141,7 @@ class Guild extends _1.Base {
1141
1141
  preferredLocale: this.preferredLocale,
1142
1142
  publicUpdatesChannelId: this.publicUpdatesChannelId,
1143
1143
  maxVideoChannelUsers: this.maxVideoChannelUsers,
1144
+ maxStageVideoChannelUsers: this.maxStageVideoChannelUsers,
1144
1145
  approximateMemberCount: this.approximateMemberCount,
1145
1146
  approximatePresenceCount: this.approximatePresenceCount,
1146
1147
  welcomeScreen: this.welcomeScreen,