disgroove 1.2.9 → 1.3.0-dev.4d9f89d

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