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