disgroove 1.2.5-dev.f1a33a1 → 1.2.6-dev.165ce79
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 +33 -26
- package/dist/Client.js +15 -18
- package/dist/Client.js.map +1 -1
- package/dist/constants.d.ts +10 -9
- package/dist/constants.js +8 -51
- package/dist/constants.js.map +1 -1
- package/dist/gateway/Shard.js +9 -52
- package/dist/gateway/Shard.js.map +1 -1
- package/dist/gateway/ShardsManager.d.ts +1 -0
- package/dist/gateway/ShardsManager.js +3 -0
- package/dist/gateway/ShardsManager.js.map +1 -1
- package/dist/rest/Endpoints.d.ts +38 -39
- package/dist/rest/Endpoints.js +85 -77
- package/dist/rest/Endpoints.js.map +1 -1
- package/dist/rest/REST.d.ts +5 -11
- package/dist/rest/REST.js +10 -10
- package/dist/rest/REST.js.map +1 -1
- package/dist/rest/RequestsManager.d.ts +1 -2
- package/dist/rest/RequestsManager.js +10 -10
- package/dist/rest/RequestsManager.js.map +1 -1
- package/dist/structures/Application.d.ts +3 -1
- package/dist/structures/Application.js +12 -16
- package/dist/structures/Application.js.map +1 -1
- package/dist/structures/ApplicationCommand.js +3 -3
- package/dist/structures/ApplicationCommand.js.map +1 -1
- package/dist/structures/AutoModerationRule.js +2 -2
- package/dist/structures/AutoModerationRule.js.map +1 -1
- package/dist/structures/Channel.d.ts +12 -14
- package/dist/structures/Channel.js +38 -69
- package/dist/structures/Channel.js.map +1 -1
- package/dist/structures/Emoji.js +2 -2
- package/dist/structures/Emoji.js.map +1 -1
- package/dist/structures/Guild.d.ts +14 -9
- package/dist/structures/Guild.js +88 -115
- package/dist/structures/Guild.js.map +1 -1
- package/dist/structures/GuildMember.d.ts +1 -1
- package/dist/structures/GuildMember.js +10 -8
- package/dist/structures/GuildMember.js.map +1 -1
- package/dist/structures/GuildScheduledEvent.js +6 -8
- package/dist/structures/GuildScheduledEvent.js.map +1 -1
- package/dist/structures/GuildTemplate.js +3 -15
- 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 +2 -1
- package/dist/structures/Interaction.js +20 -22
- package/dist/structures/Interaction.js.map +1 -1
- package/dist/structures/Invite.js +8 -38
- package/dist/structures/Invite.js.map +1 -1
- package/dist/structures/Message.d.ts +6 -2
- package/dist/structures/Message.js +20 -10
- package/dist/structures/Message.js.map +1 -1
- package/dist/structures/PartialApplication.d.ts +3 -1
- package/dist/structures/PartialApplication.js +10 -14
- package/dist/structures/PartialApplication.js.map +1 -1
- package/dist/structures/Role.js +2 -2
- package/dist/structures/Role.js.map +1 -1
- package/dist/structures/StageInstance.js +2 -2
- package/dist/structures/StageInstance.js.map +1 -1
- package/dist/structures/Sticker.js +2 -2
- package/dist/structures/Sticker.js.map +1 -1
- package/dist/structures/User.js +4 -4
- package/dist/structures/User.js.map +1 -1
- package/dist/structures/Webhook.d.ts +2 -2
- package/dist/structures/Webhook.js +42 -37
- package/dist/structures/Webhook.js.map +1 -1
- package/dist/types/gateway-events.d.ts +3 -3
- package/dist/types/interaction.d.ts +2 -0
- package/package.json +2 -2
package/dist/structures/Guild.js
CHANGED
|
@@ -185,61 +185,60 @@ class Guild extends _1.Base {
|
|
|
185
185
|
this.guildScheduledEvents = data.guild_scheduled_events.map((guildScheduledEvent) => new _1.GuildScheduledEvent(guildScheduledEvent, this.client));
|
|
186
186
|
}
|
|
187
187
|
/** https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands */
|
|
188
|
-
async getApplicationCommands(options) {
|
|
189
|
-
if (!this.applicationId)
|
|
190
|
-
throw new Error("[disgroove] Cannot find guild application ID");
|
|
188
|
+
async getApplicationCommands(applicationId, options) {
|
|
191
189
|
return this.client.rest
|
|
192
|
-
.get(rest_1.Endpoints.applicationGuildCommands(
|
|
193
|
-
|
|
194
|
-
with_localizations: options?.withLocalizations,
|
|
195
|
-
},
|
|
190
|
+
.get(rest_1.Endpoints.applicationGuildCommands(applicationId, this.id), {
|
|
191
|
+
with_localizations: options?.withLocalizations,
|
|
196
192
|
})
|
|
197
193
|
.then((response) => response.map((data) => new _1.ApplicationCommand(data, this.client)));
|
|
198
194
|
}
|
|
199
195
|
/** https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command */
|
|
200
|
-
async createApplicationCommand(options) {
|
|
201
|
-
|
|
202
|
-
throw new Error("[disgroove] Cannot find guild application ID");
|
|
203
|
-
return new _1.ApplicationCommand(await this.client.rest.post(rest_1.Endpoints.applicationGuildCommands(this.applicationId, this.id), {
|
|
196
|
+
async createApplicationCommand(applicationId, options) {
|
|
197
|
+
return new _1.ApplicationCommand(await this.client.rest.post(rest_1.Endpoints.applicationGuildCommands(applicationId, this.id), null, true, {
|
|
204
198
|
json: this.client.util.applicationCommandToRaw(options),
|
|
205
199
|
}), this.client);
|
|
206
200
|
}
|
|
207
201
|
/** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command */
|
|
208
|
-
async getApplicationCommand(commandId) {
|
|
209
|
-
|
|
210
|
-
throw new Error("[disgroove] Cannot find guild application ID");
|
|
211
|
-
return new _1.ApplicationCommand(await this.client.rest.get(rest_1.Endpoints.applicationGuildCommand(this.applicationId, this.id, commandId)), this.client);
|
|
202
|
+
async getApplicationCommand(applicationId, commandId) {
|
|
203
|
+
return new _1.ApplicationCommand(await this.client.rest.get(rest_1.Endpoints.applicationGuildCommand(applicationId, this.id, commandId)), this.client);
|
|
212
204
|
}
|
|
213
205
|
/** https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command */
|
|
214
|
-
async editApplicationCommand(commandId, options) {
|
|
215
|
-
|
|
216
|
-
throw new Error("[disgroove] Cannot find guild application ID");
|
|
217
|
-
return new _1.ApplicationCommand(await this.client.rest.patch(rest_1.Endpoints.applicationGuildCommand(this.applicationId, this.id, commandId), {
|
|
206
|
+
async editApplicationCommand(applicationId, commandId, options) {
|
|
207
|
+
return new _1.ApplicationCommand(await this.client.rest.patch(rest_1.Endpoints.applicationGuildCommand(applicationId, this.id, commandId), null, true, {
|
|
218
208
|
json: this.client.util.applicationCommandToRaw(options),
|
|
219
209
|
}), this.client);
|
|
220
210
|
}
|
|
221
211
|
/** https://discord.com/developers/docs/interactions/application-commands#delete-guild-application-command */
|
|
222
|
-
deleteApplicationCommand(commandId) {
|
|
223
|
-
|
|
224
|
-
throw new Error("[disgroove] Cannot find guild application ID");
|
|
225
|
-
this.client.rest.delete(rest_1.Endpoints.applicationGuildCommand(this.applicationId, this.id, commandId));
|
|
212
|
+
deleteApplicationCommand(applicationId, commandId) {
|
|
213
|
+
this.client.rest.delete(rest_1.Endpoints.applicationGuildCommand(applicationId, this.id, commandId));
|
|
226
214
|
}
|
|
227
215
|
/** https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands */
|
|
228
|
-
async
|
|
229
|
-
if (!this.applicationId)
|
|
230
|
-
throw new Error("[disgroove] Cannot find guild application ID");
|
|
216
|
+
async bulkOverwriteApplicationCommands(applicationId, commands) {
|
|
231
217
|
return this.client.rest
|
|
232
|
-
.put(rest_1.Endpoints.applicationGuildCommands(
|
|
233
|
-
json: this.client.util.applicationCommandToRaw(
|
|
218
|
+
.put(rest_1.Endpoints.applicationGuildCommands(applicationId, this.id), null, true, {
|
|
219
|
+
json: commands.map((command) => this.client.util.applicationCommandToRaw(command)),
|
|
234
220
|
})
|
|
235
221
|
.then((response) => response.map((data) => new _1.ApplicationCommand(data, this.client)));
|
|
236
222
|
}
|
|
237
223
|
/** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions */
|
|
238
|
-
async
|
|
239
|
-
|
|
240
|
-
|
|
224
|
+
async getApplicationCommandsPermissions(applicationId) {
|
|
225
|
+
return this.client.rest
|
|
226
|
+
.get(rest_1.Endpoints.guildApplicationCommandsPermissions(applicationId, this.id))
|
|
227
|
+
.then((response) => response.map((permissions) => ({
|
|
228
|
+
id: permissions.id,
|
|
229
|
+
applicationId: permissions.application_id,
|
|
230
|
+
guildId: permissions.guild_id,
|
|
231
|
+
permissions: permissions.permissions.map((permission) => ({
|
|
232
|
+
id: permission.id,
|
|
233
|
+
type: permission.type,
|
|
234
|
+
permission: permission.permission,
|
|
235
|
+
})),
|
|
236
|
+
})));
|
|
237
|
+
}
|
|
238
|
+
/** https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions */
|
|
239
|
+
async getApplicationCommandPermissions(applicationId, commandId) {
|
|
241
240
|
return this.client.rest
|
|
242
|
-
.get(rest_1.Endpoints.
|
|
241
|
+
.get(rest_1.Endpoints.applicationCommandPermissions(applicationId, this.id, commandId))
|
|
243
242
|
.then((response) => response.map((permissions) => ({
|
|
244
243
|
id: permissions.id,
|
|
245
244
|
applicationId: permissions.application_id,
|
|
@@ -255,13 +254,11 @@ class Guild extends _1.Base {
|
|
|
255
254
|
async getAuditLog(options) {
|
|
256
255
|
return this.client.rest
|
|
257
256
|
.get(rest_1.Endpoints.guildAuditLog(this.id), {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
limit: options?.limit,
|
|
264
|
-
},
|
|
257
|
+
user_id: options?.userId,
|
|
258
|
+
action_type: options?.actionType,
|
|
259
|
+
before: options?.before,
|
|
260
|
+
after: options?.after,
|
|
261
|
+
limit: options?.limit,
|
|
265
262
|
})
|
|
266
263
|
.then((response) => ({
|
|
267
264
|
applicationCommands: response.application_commands.map((applicationCommand) => new _1.ApplicationCommand(applicationCommand, this.client)),
|
|
@@ -312,7 +309,7 @@ class Guild extends _1.Base {
|
|
|
312
309
|
}
|
|
313
310
|
/** https://discord.com/developers/docs/resources/auto-moderation#create-auto-moderation-rule */
|
|
314
311
|
async createAutoModerationRule(options, reason) {
|
|
315
|
-
return new _1.AutoModerationRule(await this.client.rest.post(rest_1.Endpoints.guildAutoModerationRules(this.id), {
|
|
312
|
+
return new _1.AutoModerationRule(await this.client.rest.post(rest_1.Endpoints.guildAutoModerationRules(this.id), null, true, {
|
|
316
313
|
json: {
|
|
317
314
|
name: options.name,
|
|
318
315
|
event_type: options.eventType,
|
|
@@ -335,7 +332,7 @@ class Guild extends _1.Base {
|
|
|
335
332
|
}
|
|
336
333
|
/** https://discord.com/developers/docs/resources/auto-moderation#modify-auto-moderation-rule */
|
|
337
334
|
async editAutoModerationRule(ruleId, options, reason) {
|
|
338
|
-
return new _1.AutoModerationRule(await this.client.rest.patch(rest_1.Endpoints.guildAutoModerationRule(this.id, ruleId), {
|
|
335
|
+
return new _1.AutoModerationRule(await this.client.rest.patch(rest_1.Endpoints.guildAutoModerationRule(this.id, ruleId), null, true, {
|
|
339
336
|
json: {
|
|
340
337
|
name: options.name,
|
|
341
338
|
event_type: options.eventType,
|
|
@@ -358,7 +355,7 @@ class Guild extends _1.Base {
|
|
|
358
355
|
}
|
|
359
356
|
/** https://discord.com/developers/docs/resources/auto-moderation#delete-auto-moderation-rule */
|
|
360
357
|
deleteAutoModerationRule(ruleId, reason) {
|
|
361
|
-
this.client.rest.delete(rest_1.Endpoints.guildAutoModerationRule(this.id, ruleId), {
|
|
358
|
+
this.client.rest.delete(rest_1.Endpoints.guildAutoModerationRule(this.id, ruleId), null, true, {
|
|
362
359
|
reason,
|
|
363
360
|
});
|
|
364
361
|
}
|
|
@@ -374,7 +371,7 @@ class Guild extends _1.Base {
|
|
|
374
371
|
}
|
|
375
372
|
/** https://discord.com/developers/docs/resources/emoji#create-guild-emoji */
|
|
376
373
|
async createEmoji(options, reason) {
|
|
377
|
-
return new _1.Emoji(await this.client.rest.post(rest_1.Endpoints.guildEmojis(this.id), {
|
|
374
|
+
return new _1.Emoji(await this.client.rest.post(rest_1.Endpoints.guildEmojis(this.id), null, true, {
|
|
378
375
|
json: {
|
|
379
376
|
name: options.name,
|
|
380
377
|
image: options.image,
|
|
@@ -385,7 +382,7 @@ class Guild extends _1.Base {
|
|
|
385
382
|
}
|
|
386
383
|
/** https://discord.com/developers/docs/resources/emoji#modify-guild-emoji */
|
|
387
384
|
async editEmoji(emojiId, options, reason) {
|
|
388
|
-
return new _1.Emoji(await this.client.rest.patch(rest_1.Endpoints.guildEmoji(this.id, emojiId), {
|
|
385
|
+
return new _1.Emoji(await this.client.rest.patch(rest_1.Endpoints.guildEmoji(this.id, emojiId), null, true, {
|
|
389
386
|
json: {
|
|
390
387
|
name: options.name,
|
|
391
388
|
roles: options.roles,
|
|
@@ -395,7 +392,7 @@ class Guild extends _1.Base {
|
|
|
395
392
|
}
|
|
396
393
|
/** https://discord.com/developers/docs/resources/emoji#delete-guild-emoji */
|
|
397
394
|
deleteEmoji(emojiId, reason) {
|
|
398
|
-
this.client.rest.delete(rest_1.Endpoints.guildEmoji(this.id, emojiId), {
|
|
395
|
+
this.client.rest.delete(rest_1.Endpoints.guildEmoji(this.id, emojiId), null, true, {
|
|
399
396
|
reason,
|
|
400
397
|
});
|
|
401
398
|
}
|
|
@@ -434,7 +431,7 @@ class Guild extends _1.Base {
|
|
|
434
431
|
}
|
|
435
432
|
/** https://discord.com/developers/docs/resources/guild#modify-guild */
|
|
436
433
|
async edit(options, reason) {
|
|
437
|
-
return new Guild(await this.client.rest.patch(rest_1.Endpoints.guild(this.id), {
|
|
434
|
+
return new Guild(await this.client.rest.patch(rest_1.Endpoints.guild(this.id), null, true, {
|
|
438
435
|
json: {
|
|
439
436
|
name: options.name,
|
|
440
437
|
region: options.region,
|
|
@@ -473,7 +470,7 @@ class Guild extends _1.Base {
|
|
|
473
470
|
}
|
|
474
471
|
/** https://discord.com/developers/docs/resources/guild#create-guild-channel */
|
|
475
472
|
async createChannel(options, reason) {
|
|
476
|
-
return new _1.Channel(await this.client.rest.post(rest_1.Endpoints.guildChannels(this.id), {
|
|
473
|
+
return new _1.Channel(await this.client.rest.post(rest_1.Endpoints.guildChannels(this.id), null, true, {
|
|
477
474
|
json: {
|
|
478
475
|
name: options.name,
|
|
479
476
|
type: options.type,
|
|
@@ -501,7 +498,7 @@ class Guild extends _1.Base {
|
|
|
501
498
|
}
|
|
502
499
|
/** https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions */
|
|
503
500
|
editChannelPositions(options) {
|
|
504
|
-
this.client.rest.patch(rest_1.Endpoints.guildChannels(this.id), {
|
|
501
|
+
this.client.rest.patch(rest_1.Endpoints.guildChannels(this.id), null, true, {
|
|
505
502
|
json: options.map((data) => ({
|
|
506
503
|
id: data.id,
|
|
507
504
|
position: data.position,
|
|
@@ -541,17 +538,15 @@ class Guild extends _1.Base {
|
|
|
541
538
|
async searchMembers(options) {
|
|
542
539
|
return this.client.rest
|
|
543
540
|
.get(rest_1.Endpoints.guildMembersSearch(this.id), {
|
|
544
|
-
query:
|
|
545
|
-
|
|
546
|
-
limit: options.limit,
|
|
547
|
-
},
|
|
541
|
+
query: options.query,
|
|
542
|
+
limit: options.limit,
|
|
548
543
|
})
|
|
549
544
|
.then((response) => response.map((data) => new _1.GuildMember(data, this.client)));
|
|
550
545
|
}
|
|
551
546
|
/** https://discord.com/developers/docs/resources/guild#add-guild-member */
|
|
552
547
|
async addMember(userId, options) {
|
|
553
548
|
return this.client.rest
|
|
554
|
-
.put(rest_1.Endpoints.guildMember(this.id, userId), {
|
|
549
|
+
.put(rest_1.Endpoints.guildMember(this.id, userId), null, true, {
|
|
555
550
|
json: {
|
|
556
551
|
access_token: options.accessToken,
|
|
557
552
|
nick: options.nick,
|
|
@@ -571,7 +566,7 @@ class Guild extends _1.Base {
|
|
|
571
566
|
}
|
|
572
567
|
/** https://discord.com/developers/docs/resources/guild#modify-guild-member */
|
|
573
568
|
async editMember(userId, options, reason) {
|
|
574
|
-
return new _1.GuildMember(await this.client.rest.patch(rest_1.Endpoints.guildMember(this.id, userId), {
|
|
569
|
+
return new _1.GuildMember(await this.client.rest.patch(rest_1.Endpoints.guildMember(this.id, userId), null, true, {
|
|
575
570
|
json: {
|
|
576
571
|
nick: options.nick,
|
|
577
572
|
roles: options.roles,
|
|
@@ -586,7 +581,7 @@ class Guild extends _1.Base {
|
|
|
586
581
|
}
|
|
587
582
|
/** https://discord.com/developers/docs/resources/guild#modify-current-member */
|
|
588
583
|
async editCurrentMember(options, reason) {
|
|
589
|
-
return new _1.GuildMember(await this.client.rest.patch(rest_1.Endpoints.guildMember(this.id), {
|
|
584
|
+
return new _1.GuildMember(await this.client.rest.patch(rest_1.Endpoints.guildMember(this.id), null, true, {
|
|
590
585
|
json: {
|
|
591
586
|
nick: options.nick,
|
|
592
587
|
},
|
|
@@ -595,19 +590,19 @@ class Guild extends _1.Base {
|
|
|
595
590
|
}
|
|
596
591
|
/** https://discord.com/developers/docs/resources/guild#add-guild-member-role */
|
|
597
592
|
addMemberRole(userId, roleId, reason) {
|
|
598
|
-
this.client.rest.put(rest_1.Endpoints.guildMemberRole(this.id, userId, roleId), {
|
|
593
|
+
this.client.rest.put(rest_1.Endpoints.guildMemberRole(this.id, userId, roleId), null, true, {
|
|
599
594
|
reason,
|
|
600
595
|
});
|
|
601
596
|
}
|
|
602
597
|
/** https://discord.com/developers/docs/resources/guild#remove-guild-member-role */
|
|
603
598
|
removeMemberRole(userId, roleId, reason) {
|
|
604
|
-
this.client.rest.delete(rest_1.Endpoints.guildMemberRole(this.id, userId, roleId), {
|
|
599
|
+
this.client.rest.delete(rest_1.Endpoints.guildMemberRole(this.id, userId, roleId), null, true, {
|
|
605
600
|
reason,
|
|
606
601
|
});
|
|
607
602
|
}
|
|
608
603
|
/** https://discord.com/developers/docs/resources/guild#remove-guild-member-role */
|
|
609
604
|
removeMember(userId, reason) {
|
|
610
|
-
this.client.rest.delete(rest_1.Endpoints.guildMember(this.id, userId), {
|
|
605
|
+
this.client.rest.delete(rest_1.Endpoints.guildMember(this.id, userId), null, true, {
|
|
611
606
|
reason,
|
|
612
607
|
});
|
|
613
608
|
}
|
|
@@ -615,11 +610,9 @@ class Guild extends _1.Base {
|
|
|
615
610
|
async getBans(options) {
|
|
616
611
|
return this.client.rest
|
|
617
612
|
.get(rest_1.Endpoints.guildBans(this.id), {
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
after: options?.after,
|
|
622
|
-
},
|
|
613
|
+
limit: options?.limit,
|
|
614
|
+
before: options?.before,
|
|
615
|
+
after: options?.after,
|
|
623
616
|
})
|
|
624
617
|
.then((response) => response.map((data) => ({
|
|
625
618
|
reason: data.reason,
|
|
@@ -637,7 +630,7 @@ class Guild extends _1.Base {
|
|
|
637
630
|
}
|
|
638
631
|
/** https://discord.com/developers/docs/resources/guild#create-guild-ban */
|
|
639
632
|
createBan(userId, options, reason) {
|
|
640
|
-
this.client.rest.put(rest_1.Endpoints.guildBan(this.id, userId), {
|
|
633
|
+
this.client.rest.put(rest_1.Endpoints.guildBan(this.id, userId), null, true, {
|
|
641
634
|
json: {
|
|
642
635
|
delete_message_days: options?.deleteMessageDays,
|
|
643
636
|
delete_message_seconds: options?.deleteMessageSeconds,
|
|
@@ -647,7 +640,7 @@ class Guild extends _1.Base {
|
|
|
647
640
|
}
|
|
648
641
|
/** https://discord.com/developers/docs/resources/guild#remove-guild-ban */
|
|
649
642
|
removeBan(userId, reason) {
|
|
650
|
-
this.client.rest.delete(rest_1.Endpoints.guildBan(this.id, userId), {
|
|
643
|
+
this.client.rest.delete(rest_1.Endpoints.guildBan(this.id, userId), null, true, {
|
|
651
644
|
reason,
|
|
652
645
|
});
|
|
653
646
|
}
|
|
@@ -659,7 +652,7 @@ class Guild extends _1.Base {
|
|
|
659
652
|
}
|
|
660
653
|
/** https://discord.com/developers/docs/resources/guild#create-guild-role */
|
|
661
654
|
async createRole(options, reason) {
|
|
662
|
-
return new _1.Role(await this.client.rest.post(rest_1.Endpoints.guildRoles(this.id), {
|
|
655
|
+
return new _1.Role(await this.client.rest.post(rest_1.Endpoints.guildRoles(this.id), null, true, {
|
|
663
656
|
json: {
|
|
664
657
|
name: options.name,
|
|
665
658
|
permissions: options.permissions,
|
|
@@ -675,7 +668,7 @@ class Guild extends _1.Base {
|
|
|
675
668
|
/** https://discord.com/developers/docs/resources/guild#modify-guild-role-positions */
|
|
676
669
|
async editRolePositions(options) {
|
|
677
670
|
return this.client.rest
|
|
678
|
-
.patch(rest_1.Endpoints.guildRoles(this.id), {
|
|
671
|
+
.patch(rest_1.Endpoints.guildRoles(this.id), null, true, {
|
|
679
672
|
json: options.map((data) => ({
|
|
680
673
|
id: data.id,
|
|
681
674
|
position: data.position,
|
|
@@ -685,7 +678,7 @@ class Guild extends _1.Base {
|
|
|
685
678
|
}
|
|
686
679
|
/** https://discord.com/developers/docs/resources/guild#modify-guild-role */
|
|
687
680
|
async editRole(roleId, options, reason) {
|
|
688
|
-
return new _1.Role(await this.client.rest.patch(rest_1.Endpoints.guildRole(this.id, roleId), {
|
|
681
|
+
return new _1.Role(await this.client.rest.patch(rest_1.Endpoints.guildRole(this.id, roleId), null, true, {
|
|
689
682
|
json: {
|
|
690
683
|
name: options?.name,
|
|
691
684
|
permissions: options?.permissions,
|
|
@@ -700,7 +693,7 @@ class Guild extends _1.Base {
|
|
|
700
693
|
}
|
|
701
694
|
/** https://discord.com/developers/docs/resources/guild#modify-guild-mfa-level */
|
|
702
695
|
async editMFALevel(options, reason) {
|
|
703
|
-
return this.client.rest.post(rest_1.Endpoints.guildMFA(this.id), {
|
|
696
|
+
return this.client.rest.post(rest_1.Endpoints.guildMFA(this.id), null, true, {
|
|
704
697
|
json: {
|
|
705
698
|
level: options.level,
|
|
706
699
|
},
|
|
@@ -709,22 +702,20 @@ class Guild extends _1.Base {
|
|
|
709
702
|
}
|
|
710
703
|
/** https://discord.com/developers/docs/resources/guild#delete-guild-role */
|
|
711
704
|
deleteRole(roleId, reason) {
|
|
712
|
-
this.client.rest.delete(rest_1.Endpoints.guildRole(this.id, roleId), {
|
|
705
|
+
this.client.rest.delete(rest_1.Endpoints.guildRole(this.id, roleId), null, true, {
|
|
713
706
|
reason,
|
|
714
707
|
});
|
|
715
708
|
}
|
|
716
709
|
/** https://discord.com/developers/docs/resources/guild#get-guild-prune-count */
|
|
717
710
|
async getPruneCount(options) {
|
|
718
711
|
return this.client.rest.get(rest_1.Endpoints.guildPrune(this.id), {
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
include_roles: options.includeRoles,
|
|
722
|
-
},
|
|
712
|
+
days: options.days,
|
|
713
|
+
include_roles: options.includeRoles,
|
|
723
714
|
});
|
|
724
715
|
}
|
|
725
716
|
/** https://discord.com/developers/docs/resources/guild#begin-guild-prune */
|
|
726
717
|
async beginGuildPrune(options, reason) {
|
|
727
|
-
return this.client.rest.post(rest_1.Endpoints.guildPrune(this.id), {
|
|
718
|
+
return this.client.rest.post(rest_1.Endpoints.guildPrune(this.id), null, true, {
|
|
728
719
|
json: {
|
|
729
720
|
days: options.days,
|
|
730
721
|
compute_prune_count: options.computePruneCount,
|
|
@@ -760,7 +751,7 @@ class Guild extends _1.Base {
|
|
|
760
751
|
}
|
|
761
752
|
/** https://discord.com/developers/docs/resources/guild#delete-guild-integration */
|
|
762
753
|
deleteIntegration(integrationId, reason) {
|
|
763
|
-
this.client.rest.delete(rest_1.Endpoints.guildIntegration(this.id, integrationId), {
|
|
754
|
+
this.client.rest.delete(rest_1.Endpoints.guildIntegration(this.id, integrationId), null, true, {
|
|
764
755
|
reason,
|
|
765
756
|
});
|
|
766
757
|
}
|
|
@@ -776,7 +767,7 @@ class Guild extends _1.Base {
|
|
|
776
767
|
/** https://discord.com/developers/docs/resources/guild#modify-guild-widget */
|
|
777
768
|
async editWidget(options, reason) {
|
|
778
769
|
return this.client.rest
|
|
779
|
-
.patch(rest_1.Endpoints.guildWidgetSettings(this.id), {
|
|
770
|
+
.patch(rest_1.Endpoints.guildWidgetSettings(this.id), null, true, {
|
|
780
771
|
json: {
|
|
781
772
|
enabled: options.enabled,
|
|
782
773
|
channel_id: options.channelId,
|
|
@@ -802,15 +793,13 @@ class Guild extends _1.Base {
|
|
|
802
793
|
}));
|
|
803
794
|
}
|
|
804
795
|
/** https://discord.com/developers/docs/resources/guild#get-guild-vanity-url */
|
|
805
|
-
|
|
806
|
-
return
|
|
796
|
+
getVanityURL() {
|
|
797
|
+
return this.client.rest.get(rest_1.Endpoints.guildVanityUrl(this.id));
|
|
807
798
|
}
|
|
808
799
|
/** https://discord.com/developers/docs/resources/guild#get-guild-widget-image */
|
|
809
800
|
async getWidgetImage(options) {
|
|
810
801
|
return this.client.rest.get(rest_1.Endpoints.guildWidgetImage(this.id), {
|
|
811
|
-
|
|
812
|
-
style: options?.style,
|
|
813
|
-
},
|
|
802
|
+
style: options?.style,
|
|
814
803
|
});
|
|
815
804
|
}
|
|
816
805
|
/** https://discord.com/developers/docs/resources/guild#get-guild-welcome-screen */
|
|
@@ -830,7 +819,7 @@ class Guild extends _1.Base {
|
|
|
830
819
|
/** https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen */
|
|
831
820
|
async editWelcomeScreen(options, reason) {
|
|
832
821
|
return this.client.rest
|
|
833
|
-
.patch(rest_1.Endpoints.guildWelcomeScreen(this.id), {
|
|
822
|
+
.patch(rest_1.Endpoints.guildWelcomeScreen(this.id), null, true, {
|
|
834
823
|
json: {
|
|
835
824
|
enabled: options.enabled,
|
|
836
825
|
welcome_channels: options.welcomeChannels,
|
|
@@ -877,7 +866,7 @@ class Guild extends _1.Base {
|
|
|
877
866
|
}
|
|
878
867
|
/** https://discord.com/developers/docs/resources/guild#modify-guild-onboarding */
|
|
879
868
|
editOnboarding(options, reason) {
|
|
880
|
-
this.client.rest.patch(rest_1.Endpoints.guildOnboarding(this.id), {
|
|
869
|
+
this.client.rest.patch(rest_1.Endpoints.guildOnboarding(this.id), null, true, {
|
|
881
870
|
json: {
|
|
882
871
|
prompts: options.prompts.map((prompt) => ({
|
|
883
872
|
id: prompt.id,
|
|
@@ -910,7 +899,7 @@ class Guild extends _1.Base {
|
|
|
910
899
|
}
|
|
911
900
|
/** https://discord.com/developers/docs/resources/guild#modify-current-user-voice-state */
|
|
912
901
|
editCurrentUserVoiceState(options) {
|
|
913
|
-
this.client.rest.patch(rest_1.Endpoints.guildVoiceState(this.id), {
|
|
902
|
+
this.client.rest.patch(rest_1.Endpoints.guildVoiceState(this.id), null, true, {
|
|
914
903
|
json: {
|
|
915
904
|
channel_id: options.channelId,
|
|
916
905
|
suppress: options.suppress,
|
|
@@ -920,7 +909,7 @@ class Guild extends _1.Base {
|
|
|
920
909
|
}
|
|
921
910
|
/** https://discord.com/developers/docs/resources/guild#modify-user-voice-state */
|
|
922
911
|
editUserVoiceState(userId, options) {
|
|
923
|
-
this.client.rest.patch(rest_1.Endpoints.guildVoiceState(this.id, userId), {
|
|
912
|
+
this.client.rest.patch(rest_1.Endpoints.guildVoiceState(this.id, userId), null, true, {
|
|
924
913
|
json: {
|
|
925
914
|
channel_id: options.channelId,
|
|
926
915
|
suppress: options.suppress,
|
|
@@ -932,15 +921,13 @@ class Guild extends _1.Base {
|
|
|
932
921
|
async getScheduledEvents(options) {
|
|
933
922
|
return this.client.rest
|
|
934
923
|
.get(rest_1.Endpoints.guildScheduledEvents(this.id), {
|
|
935
|
-
|
|
936
|
-
with_user_count: options?.withUserCount,
|
|
937
|
-
},
|
|
924
|
+
with_user_count: options?.withUserCount,
|
|
938
925
|
})
|
|
939
926
|
.then((response) => response.map((data) => new _1.GuildScheduledEvent(data, this.client)));
|
|
940
927
|
}
|
|
941
928
|
/** https://discord.com/developers/docs/resources/guild-scheduled-event#create-guild-scheduled-event */
|
|
942
929
|
async createScheduledEvent(options, reason) {
|
|
943
|
-
return new _1.GuildScheduledEvent(await this.client.rest.post(rest_1.Endpoints.guildScheduledEvents(this.id), {
|
|
930
|
+
return new _1.GuildScheduledEvent(await this.client.rest.post(rest_1.Endpoints.guildScheduledEvents(this.id), null, true, {
|
|
944
931
|
json: {
|
|
945
932
|
channel_id: options.channelId,
|
|
946
933
|
entity_metadata: options.entityMetadata,
|
|
@@ -957,7 +944,7 @@ class Guild extends _1.Base {
|
|
|
957
944
|
}
|
|
958
945
|
/** https://discord.com/developers/docs/resources/guild-scheduled-event#modify-guild-scheduled-event */
|
|
959
946
|
async editScheduledEvent(scheduledEventId, options, reason) {
|
|
960
|
-
return new _1.GuildScheduledEvent(await this.client.rest.patch(rest_1.Endpoints.guildScheduledEvent(this.id, scheduledEventId), {
|
|
947
|
+
return new _1.GuildScheduledEvent(await this.client.rest.patch(rest_1.Endpoints.guildScheduledEvent(this.id, scheduledEventId), null, true, {
|
|
961
948
|
json: {
|
|
962
949
|
channel_id: options.channelId,
|
|
963
950
|
entity_metadata: options.entityMetadata,
|
|
@@ -981,12 +968,10 @@ class Guild extends _1.Base {
|
|
|
981
968
|
async getScheduledEventUsers(scheduledEventId, options) {
|
|
982
969
|
return this.client.rest
|
|
983
970
|
.get(rest_1.Endpoints.guildScheduledEvent(this.id, scheduledEventId), {
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
after: options?.after,
|
|
989
|
-
},
|
|
971
|
+
limit: options?.limit,
|
|
972
|
+
with_member: options?.withMember,
|
|
973
|
+
before: options?.before,
|
|
974
|
+
after: options?.after,
|
|
990
975
|
})
|
|
991
976
|
.then((response) => response.map((data) => ({
|
|
992
977
|
guildScheduledEventId: data.guild_scheduled_event_id,
|
|
@@ -1008,7 +993,7 @@ class Guild extends _1.Base {
|
|
|
1008
993
|
}
|
|
1009
994
|
/** https://discord.com/developers/docs/resources/guild-template#create-guild-template */
|
|
1010
995
|
async createTemplate(options) {
|
|
1011
|
-
return new _1.GuildTemplate(await this.client.rest.post(rest_1.Endpoints.guildTemplates(this.id), {
|
|
996
|
+
return new _1.GuildTemplate(await this.client.rest.post(rest_1.Endpoints.guildTemplates(this.id), null, true, {
|
|
1012
997
|
json: {
|
|
1013
998
|
name: options.name,
|
|
1014
999
|
description: options.description,
|
|
@@ -1021,7 +1006,7 @@ class Guild extends _1.Base {
|
|
|
1021
1006
|
}
|
|
1022
1007
|
/** https://discord.com/developers/docs/resources/guild-template#modify-guild-template */
|
|
1023
1008
|
async editTemplate(code, options) {
|
|
1024
|
-
return new _1.GuildTemplate(await this.client.rest.patch(rest_1.Endpoints.guildTemplate(this.id, code), {
|
|
1009
|
+
return new _1.GuildTemplate(await this.client.rest.patch(rest_1.Endpoints.guildTemplate(this.id, code), null, true, {
|
|
1025
1010
|
json: {
|
|
1026
1011
|
name: options.name,
|
|
1027
1012
|
description: options.description,
|
|
@@ -1032,19 +1017,7 @@ class Guild extends _1.Base {
|
|
|
1032
1017
|
async deleteTemplate(code) {
|
|
1033
1018
|
return this.client.rest
|
|
1034
1019
|
.delete(rest_1.Endpoints.guildTemplate(this.id, code))
|
|
1035
|
-
.then((response) => (
|
|
1036
|
-
code: response.code,
|
|
1037
|
-
name: response.name,
|
|
1038
|
-
description: response.description,
|
|
1039
|
-
usageCount: response.usage_count,
|
|
1040
|
-
creatorId: response.creator_id,
|
|
1041
|
-
creator: new _1.User(response.creator, this.client),
|
|
1042
|
-
createdAt: response.created_at,
|
|
1043
|
-
updatedAt: response.updated_at,
|
|
1044
|
-
sourceGuildId: response.source_guild_id,
|
|
1045
|
-
serializedSourceGuild: new Guild(response.serialized_source_guild, this.client),
|
|
1046
|
-
isDirty: response.is_dirty,
|
|
1047
|
-
}));
|
|
1020
|
+
.then((response) => new _1.GuildTemplate(response, this.client).toJSON());
|
|
1048
1021
|
}
|
|
1049
1022
|
/** https://discord.com/developers/docs/resources/sticker#list-guild-stickers */
|
|
1050
1023
|
async getStickers() {
|
|
@@ -1066,7 +1039,7 @@ class Guild extends _1.Base {
|
|
|
1066
1039
|
formData.set("tags", options.tags);
|
|
1067
1040
|
formData.set("file", new undici_1.File([options.file.contents], options.file.name));
|
|
1068
1041
|
return this.client.rest
|
|
1069
|
-
.post(rest_1.Endpoints.guildStickers(this.id), {
|
|
1042
|
+
.post(rest_1.Endpoints.guildStickers(this.id), null, true, {
|
|
1070
1043
|
form: formData,
|
|
1071
1044
|
reason,
|
|
1072
1045
|
})
|
|
@@ -1075,7 +1048,7 @@ class Guild extends _1.Base {
|
|
|
1075
1048
|
/** https://discord.com/developers/docs/resources/sticker#modify-guild-sticker */
|
|
1076
1049
|
async editSticker(stickerId, options, reason) {
|
|
1077
1050
|
return this.client.rest
|
|
1078
|
-
.patch(rest_1.Endpoints.guildSticker(this.id, stickerId), {
|
|
1051
|
+
.patch(rest_1.Endpoints.guildSticker(this.id, stickerId), null, true, {
|
|
1079
1052
|
json: {
|
|
1080
1053
|
name: options.name,
|
|
1081
1054
|
description: options.description,
|
|
@@ -1087,7 +1060,7 @@ class Guild extends _1.Base {
|
|
|
1087
1060
|
}
|
|
1088
1061
|
/** https://discord.com/developers/docs/resources/sticker#delete-guild-sticker */
|
|
1089
1062
|
deleteSticker(stickerId, reason) {
|
|
1090
|
-
this.client.rest.delete(rest_1.Endpoints.guildSticker(this.id, stickerId), {
|
|
1063
|
+
this.client.rest.delete(rest_1.Endpoints.guildSticker(this.id, stickerId), null, true, {
|
|
1091
1064
|
reason,
|
|
1092
1065
|
});
|
|
1093
1066
|
}
|