disgroove 2.2.4 → 2.2.5-dev.86e9686
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/lib/Client.d.ts +48 -4
- package/dist/lib/Client.js +184 -72
- package/dist/lib/constants.d.ts +36 -5
- package/dist/lib/constants.js +35 -3
- package/dist/lib/gateway/Shard.d.ts +3 -1
- package/dist/lib/gateway/Shard.js +28 -0
- package/dist/lib/rest/Endpoints.d.ts +4 -0
- package/dist/lib/rest/Endpoints.js +12 -3
- package/dist/lib/transformers/ApplicationCommands.js +2 -0
- package/dist/lib/transformers/Interactions.d.ts +3 -1
- package/dist/lib/transformers/Interactions.js +42 -0
- package/dist/lib/transformers/Soundboards.d.ts +5 -0
- package/dist/lib/transformers/Soundboards.js +31 -0
- package/dist/lib/transformers/index.d.ts +1 -0
- package/dist/lib/transformers/index.js +1 -0
- package/dist/lib/types/application-command.d.ts +3 -1
- package/dist/lib/types/gateway-events.d.ts +21 -0
- package/dist/lib/types/guild.d.ts +2 -0
- package/dist/lib/types/interaction.d.ts +44 -0
- package/dist/lib/types/soundboard.d.ts +23 -0
- package/dist/lib/types/soundboard.js +2 -0
- package/dist/lib/utils/CDN.d.ts +1 -0
- package/dist/lib/utils/CDN.js +3 -1
- package/dist/lib/utils/formatters.d.ts +2 -2
- package/dist/lib/utils/formatters.js +5 -2
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/lib/Client.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
/// <reference types="node" />
|
2
|
+
/// <reference types="node" />
|
2
3
|
import { GatewayIntents, type OAuth2Scopes, type ActionTypes, type ImageWidgetStyleOptions, type MFALevel, type ReactionTypes, type ApplicationCommandTypes, type EventTypes, type TriggerTypes, type ChannelTypes, type VideoQualityModes, type SortOrderTypes, type ForumLayoutTypes, type InviteTargetTypes, type VerificationLevel, type DefaultMessageNotificationLevel, type ExplicitContentFilterLevel, type SystemChannelFlags, type ApplicationFlags, type ApplicationIntegrationTypes, type ChannelFlags, type GuildFeatures, type GuildScheduledEventEntityTypes, type GuildScheduledEventPrivacyLevel, type GuildScheduledEventStatus, type MessageFlags, type OnboardingMode, type PrivacyLevel, type GuildMemberFlags, type InteractionContextTypes } from "./constants";
|
3
4
|
import { RequestManager, type File } from "./rest";
|
4
5
|
import EventEmitter from "node:events";
|
@@ -12,11 +13,11 @@ import type { Channel, FollowedChannel, ThreadMember, Overwrite, DefaultReaction
|
|
12
13
|
import type { LocaleMap, snowflake, timestamp } from "./types/common";
|
13
14
|
import type { Emoji } from "./types/emoji";
|
14
15
|
import type { Entitlement } from "./types/entitlements";
|
15
|
-
import type { AutoModerationActionExecutionEventFields, ChannelPinsUpdateEventFields, ThreadListSyncEventFields, ThreadMemberUpdateEventExtraFields, ThreadMembersUpdateEventFields, GuildCreateEventExtraFields, GuildAuditLogEntryCreateExtraFields, GuildBanAddEventFields, GuildBanRemoveEventFields, GuildMemberAddEventExtraFields, GuildMemberRemoveEventFields, GuildMemberUpdateEventFields, GuildMembersChunkEventFields, IntegrationCreateEventExtraFields, IntegrationUpdateEventExtraFields, IntegrationDeleteEventFields, InviteCreateEventFields, InviteDeleteEventFields, MessageCreateEventExtraFields, MessageDeleteEventFields, MessageDeleteBulkEventFields, MessageReactionAddEventFields, MessageReactionRemoveEventFields, MessageReactionRemoveAllEventFields, MessageReactionRemoveEmojiEventFields, PresenceUpdateEventFields, TypingStartEventFields, VoiceServerUpdateEventFields, MessagePollVoteAddFields, MessagePollVoteRemoveFields, GatewayPresenceUpdate, RawPayload, IdentifyConnectionProperties, VoiceChannelEffectSendEventFields } from "./types/gateway-events";
|
16
|
+
import type { AutoModerationActionExecutionEventFields, ChannelPinsUpdateEventFields, ThreadListSyncEventFields, ThreadMemberUpdateEventExtraFields, ThreadMembersUpdateEventFields, GuildCreateEventExtraFields, GuildAuditLogEntryCreateExtraFields, GuildBanAddEventFields, GuildBanRemoveEventFields, GuildMemberAddEventExtraFields, GuildMemberRemoveEventFields, GuildMemberUpdateEventFields, GuildMembersChunkEventFields, IntegrationCreateEventExtraFields, IntegrationUpdateEventExtraFields, IntegrationDeleteEventFields, InviteCreateEventFields, InviteDeleteEventFields, MessageCreateEventExtraFields, MessageDeleteEventFields, MessageDeleteBulkEventFields, MessageReactionAddEventFields, MessageReactionRemoveEventFields, MessageReactionRemoveAllEventFields, MessageReactionRemoveEmojiEventFields, PresenceUpdateEventFields, TypingStartEventFields, VoiceServerUpdateEventFields, MessagePollVoteAddFields, MessagePollVoteRemoveFields, GatewayPresenceUpdate, RawPayload, IdentifyConnectionProperties, VoiceChannelEffectSendEventFields, GuildSoundboardSoundDeleteEventFields } from "./types/gateway-events";
|
16
17
|
import type { Guild, GuildMember, WelcomeScreen, GuildWidgetSettings, Ban, Integration, GuildOnboarding, GuildPreview, GuildWidget, UnavailableGuild, OnboardingPrompt, WelcomeScreenChannel } from "./types/guild";
|
17
18
|
import type { GuildScheduledEvent, GuildScheduledEventUser, GuildScheduledEventEntityMetadata, GuildScheduledEventRecurrenceRule } from "./types/guild-scheduled-event";
|
18
19
|
import type { GuildTemplate } from "./types/guild-template";
|
19
|
-
import type { Interaction, InteractionResponse } from "./types/interaction";
|
20
|
+
import type { Interaction, InteractionCallbackResponse, InteractionResponse } from "./types/interaction";
|
20
21
|
import type { Invite } from "./types/invite";
|
21
22
|
import type { ActionRow } from "./types/message-components";
|
22
23
|
import type { PollCreateParams } from "./types/poll";
|
@@ -29,7 +30,8 @@ import type { VoiceRegion, VoiceState } from "./types/voice";
|
|
29
30
|
import type { Webhook } from "./types/webhook";
|
30
31
|
import type { ClientOptions as WebSocketOptions } from "ws";
|
31
32
|
import type { Embed, AllowedMentions, Attachment, Message, MessageReference } from "./types/message";
|
32
|
-
import { Subscription } from "./types/subscription";
|
33
|
+
import type { Subscription } from "./types/subscription";
|
34
|
+
import type { SoundboardSound } from "./types/soundboard";
|
33
35
|
export interface GatewayOptions {
|
34
36
|
properties?: IdentifyConnectionProperties;
|
35
37
|
compress?: boolean;
|
@@ -285,6 +287,14 @@ export declare class Client extends EventEmitter {
|
|
285
287
|
tags: string;
|
286
288
|
file: File;
|
287
289
|
}, reason?: string): Promise<Sticker>;
|
290
|
+
/** https://discord.com/developers/docs/resources/soundboard#create-guild-soundboard-sound */
|
291
|
+
createGuildSoundboardSound(guildID: snowflake, options: {
|
292
|
+
name: string;
|
293
|
+
sound: Buffer;
|
294
|
+
volume?: number | null;
|
295
|
+
emojiID?: snowflake | null;
|
296
|
+
emojiName?: snowflake | null;
|
297
|
+
}, reason?: string): Promise<SoundboardSound>;
|
288
298
|
/** https://discord.com/developers/docs/resources/guild-template#create-guild-template */
|
289
299
|
createGuildTemplate(guildID: snowflake, options: {
|
290
300
|
name: string;
|
@@ -305,7 +315,9 @@ export declare class Client extends EventEmitter {
|
|
305
315
|
poll?: PollCreateParams;
|
306
316
|
}): Promise<Message>;
|
307
317
|
/** https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response */
|
308
|
-
createInteractionResponse(interactionID: snowflake, interactionToken: string, options: InteractionResponse
|
318
|
+
createInteractionResponse(interactionID: snowflake, interactionToken: string, options: InteractionResponse & {
|
319
|
+
withResponse?: boolean;
|
320
|
+
}): Promise<void | InteractionCallbackResponse>;
|
309
321
|
/** https://discord.com/developers/docs/resources/message#create-message */
|
310
322
|
createMessage(channelID: snowflake, options: {
|
311
323
|
content?: string;
|
@@ -397,6 +409,8 @@ export declare class Client extends EventEmitter {
|
|
397
409
|
deleteGuildScheduledEvent(guildID: snowflake, guildScheduledEventID: snowflake): void;
|
398
410
|
/** https://discord.com/developers/docs/resources/sticker#delete-guild-sticker */
|
399
411
|
deleteGuildSticker(guildID: snowflake, stickerID: snowflake, reason?: string): void;
|
412
|
+
/** https://discord.com/developers/docs/resources/soundboard#delete-guild-soundboard-sound */
|
413
|
+
deleteGuildSoundboardSound(guildID: snowflake, soundID: snowflake, reason?: string): void;
|
400
414
|
/** https://discord.com/developers/docs/resources/guild-template#delete-guild-template */
|
401
415
|
deleteGuildTemplate(guildID: snowflake, code: string): Promise<GuildTemplate>;
|
402
416
|
/** https://discord.com/developers/docs/resources/invite#delete-invite */
|
@@ -617,6 +631,13 @@ export declare class Client extends EventEmitter {
|
|
617
631
|
description?: string | null;
|
618
632
|
tags?: string;
|
619
633
|
}, reason?: string): Promise<Sticker>;
|
634
|
+
/** https://discord.com/developers/docs/resources/soundboard#edit-guild-soundboard-sound */
|
635
|
+
editGuildSoundboardSound(guildID: snowflake, soundID: snowflake, options: {
|
636
|
+
name?: string;
|
637
|
+
volume?: number | null;
|
638
|
+
emojiID?: snowflake | null;
|
639
|
+
emojiName?: snowflake | null;
|
640
|
+
}, reason?: string): Promise<SoundboardSound>;
|
620
641
|
/** https://discord.com/developers/docs/resources/guild-template#modify-guild-template */
|
621
642
|
editGuildTemplate(guildID: snowflake, code: string, options: {
|
622
643
|
name?: string;
|
@@ -656,6 +677,7 @@ export declare class Client extends EventEmitter {
|
|
656
677
|
components?: Array<ActionRow> | null;
|
657
678
|
files?: Array<File> | null;
|
658
679
|
attachments?: Array<Partial<Attachment>> | null;
|
680
|
+
poll?: PollCreateParams | null;
|
659
681
|
threadID?: snowflake;
|
660
682
|
}): Promise<Message>;
|
661
683
|
/** https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response */
|
@@ -666,6 +688,7 @@ export declare class Client extends EventEmitter {
|
|
666
688
|
components?: Array<ActionRow> | null;
|
667
689
|
files?: Array<File> | null;
|
668
690
|
attachments?: Array<Partial<Attachment>> | null;
|
691
|
+
poll?: PollCreateParams | null;
|
669
692
|
threadID?: snowflake;
|
670
693
|
}): Promise<Message>;
|
671
694
|
/** https://discord.com/developers/docs/resources/guild#modify-user-voice-state */
|
@@ -687,6 +710,7 @@ export declare class Client extends EventEmitter {
|
|
687
710
|
components?: Array<ActionRow> | null;
|
688
711
|
files?: Array<File> | null;
|
689
712
|
attachments?: Array<Partial<Attachment>> | null;
|
713
|
+
poll?: PollCreateParams | null;
|
690
714
|
threadID?: snowflake;
|
691
715
|
}): Promise<Message>;
|
692
716
|
/** https://discord.com/developers/docs/resources/webhook#modify-webhook-with-token */
|
@@ -783,6 +807,8 @@ export declare class Client extends EventEmitter {
|
|
783
807
|
getCurrentUserConnections(): Promise<Array<Connection>>;
|
784
808
|
/** https://discord.com/developers/docs/resources/voice#get-current-user-voice-state */
|
785
809
|
getCurrentUserVoiceState(guildID: snowflake): Promise<VoiceState>;
|
810
|
+
/** https://discord.com/developers/docs/resources/soundboard#list-default-soundboard-sounds */
|
811
|
+
getDefaultSoundboardSounds(): Promise<Array<SoundboardSound>>;
|
786
812
|
/** https://discord.com/developers/docs/resources/entitlement#list-entitlements */
|
787
813
|
getEntitlements(applicationID: snowflake, options?: {
|
788
814
|
userID?: snowflake;
|
@@ -883,6 +909,11 @@ export declare class Client extends EventEmitter {
|
|
883
909
|
getGuildSticker(guildID: snowflake, stickerID: snowflake): Promise<Sticker>;
|
884
910
|
/** https://discord.com/developers/docs/resources/sticker#list-guild-stickers */
|
885
911
|
getGuildStickers(guildID: snowflake): Promise<Array<Sticker>>;
|
912
|
+
/** https://discord.com/developers/docs/resources/soundboard#get-guild-soundboard-sound */
|
913
|
+
getGuildSoundboardSound(guildID: snowflake, soundID: snowflake): Promise<SoundboardSound>;
|
914
|
+
getGuildSoundboardSounds(guildID: snowflake): Promise<{
|
915
|
+
items: Array<SoundboardSound>;
|
916
|
+
}>;
|
886
917
|
/** https://discord.com/developers/docs/resources/guild-template#get-guild-template */
|
887
918
|
getGuildTemplate(guildID: snowflake, code: string): Promise<GuildTemplate>;
|
888
919
|
/** https://discord.com/developers/docs/resources/guild-template#get-guild-templates */
|
@@ -1031,6 +1062,11 @@ export declare class Client extends EventEmitter {
|
|
1031
1062
|
query: string;
|
1032
1063
|
limit?: number;
|
1033
1064
|
}): Promise<Array<GuildMember>>;
|
1065
|
+
/** https://discord.com/developers/docs/resources/soundboard#send-soundboard-sound */
|
1066
|
+
sendSoundboardSound(channelID: snowflake, options: {
|
1067
|
+
soundID: snowflake;
|
1068
|
+
sourceGuildID?: snowflake;
|
1069
|
+
}): void;
|
1034
1070
|
/** https://discord.com/developers/docs/topics/gateway-events#update-presence */
|
1035
1071
|
setPresence(options: Partial<Pick<GatewayPresenceUpdate, "activities" | "status" | "afk">>): void;
|
1036
1072
|
/** https://discord.com/developers/docs/resources/guild-template#sync-guild-template */
|
@@ -1127,6 +1163,14 @@ export interface ClientEvents {
|
|
1127
1163
|
guildScheduledEventID: snowflake,
|
1128
1164
|
guildID: snowflake
|
1129
1165
|
];
|
1166
|
+
guildSoundboardSoundCreate: [sound: SoundboardSound];
|
1167
|
+
guildSoundboardSoundUpdate: [sound: SoundboardSound];
|
1168
|
+
guildSoundboardSoundDelete: [sound: GuildSoundboardSoundDeleteEventFields];
|
1169
|
+
guildSoundboardSoundsUpdate: [
|
1170
|
+
sounds: Array<SoundboardSound>,
|
1171
|
+
guildID: snowflake
|
1172
|
+
];
|
1173
|
+
soundboardSounds: [sounds: Array<SoundboardSound>, guildID: snowflake];
|
1130
1174
|
integrationCreate: [
|
1131
1175
|
integration: Integration & IntegrationCreateEventExtraFields
|
1132
1176
|
];
|
package/dist/lib/Client.js
CHANGED
@@ -418,6 +418,20 @@ class Client extends node_events_1.default {
|
|
418
418
|
});
|
419
419
|
return transformers_1.Stickers.stickerFromRaw(response);
|
420
420
|
}
|
421
|
+
/** https://discord.com/developers/docs/resources/soundboard#create-guild-soundboard-sound */
|
422
|
+
async createGuildSoundboardSound(guildID, options, reason) {
|
423
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildSoundboardSounds(guildID), {
|
424
|
+
json: {
|
425
|
+
name: options.name,
|
426
|
+
sound: options.sound,
|
427
|
+
volume: options.volume,
|
428
|
+
emoji_id: options.emojiID,
|
429
|
+
emoji_name: options.emojiName,
|
430
|
+
},
|
431
|
+
reason,
|
432
|
+
});
|
433
|
+
return transformers_1.Soundboards.soundboardSoundFromRaw(response);
|
434
|
+
}
|
421
435
|
/** https://discord.com/developers/docs/resources/guild-template#create-guild-template */
|
422
436
|
async createGuildTemplate(guildID, options) {
|
423
437
|
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.guildTemplates(guildID), {
|
@@ -469,106 +483,118 @@ class Client extends node_events_1.default {
|
|
469
483
|
return transformers_1.Messages.messageFromRaw(response);
|
470
484
|
}
|
471
485
|
/** https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response */
|
472
|
-
createInteractionResponse(interactionID, interactionToken, options) {
|
486
|
+
async createInteractionResponse(interactionID, interactionToken, options) {
|
487
|
+
let json;
|
488
|
+
let files;
|
473
489
|
switch (options.type) {
|
474
490
|
case constants_1.InteractionCallbackType.ChannelMessageWithSource:
|
475
491
|
case constants_1.InteractionCallbackType.UpdateMessage:
|
476
492
|
{
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
: undefined,
|
510
|
-
},
|
493
|
+
json = {
|
494
|
+
type: options.type,
|
495
|
+
data: {
|
496
|
+
content: options.data?.content,
|
497
|
+
embeds: options.data?.embeds !== undefined
|
498
|
+
? options.data.embeds.map((embed) => transformers_1.Messages.embedToRaw(embed))
|
499
|
+
: undefined,
|
500
|
+
allowed_mentions: options.data?.allowedMentions !== undefined
|
501
|
+
? {
|
502
|
+
parse: options.data.allowedMentions.parse,
|
503
|
+
roles: options.data.allowedMentions.roles,
|
504
|
+
users: options.data.allowedMentions.users,
|
505
|
+
replied_user: options.data.allowedMentions.repliedUser,
|
506
|
+
}
|
507
|
+
: undefined,
|
508
|
+
flags: options.data?.flags,
|
509
|
+
components: options.data?.components !== undefined
|
510
|
+
? transformers_1.Messages.componentsToRaw(options.data.components)
|
511
|
+
: undefined,
|
512
|
+
attachments: options.data?.attachments,
|
513
|
+
poll: options.data?.poll !== undefined
|
514
|
+
? {
|
515
|
+
question: options.data.poll.question,
|
516
|
+
answers: options.data.poll.answers.map((answer) => ({
|
517
|
+
answer_id: answer.answerID,
|
518
|
+
poll_media: answer.pollMedia,
|
519
|
+
})),
|
520
|
+
duration: options.data.poll.duration,
|
521
|
+
allow_multiselect: options.data.poll.allowMultiselect,
|
522
|
+
layout_type: options.data.poll.layoutType,
|
523
|
+
}
|
524
|
+
: undefined,
|
511
525
|
},
|
512
|
-
|
513
|
-
|
526
|
+
};
|
527
|
+
files = options.data?.files;
|
514
528
|
}
|
515
529
|
break;
|
516
530
|
case constants_1.InteractionCallbackType.DeferredChannelMessageWithSource:
|
517
531
|
case constants_1.InteractionCallbackType.DeferredUpdateMessage:
|
518
532
|
{
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
flags: options.data?.flags,
|
524
|
-
},
|
533
|
+
json = {
|
534
|
+
type: options.type,
|
535
|
+
data: {
|
536
|
+
flags: options.data?.flags,
|
525
537
|
},
|
526
|
-
}
|
538
|
+
};
|
527
539
|
}
|
528
540
|
break;
|
529
541
|
case constants_1.InteractionCallbackType.ApplicationCommandAutocompleteResult:
|
530
542
|
{
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
})),
|
540
|
-
},
|
543
|
+
json = {
|
544
|
+
type: options.type,
|
545
|
+
data: {
|
546
|
+
choices: options.data?.choices?.map((choice) => ({
|
547
|
+
name: choice.name,
|
548
|
+
name_localizations: choice.nameLocalizations,
|
549
|
+
value: choice.value,
|
550
|
+
})),
|
541
551
|
},
|
542
|
-
}
|
552
|
+
};
|
543
553
|
}
|
544
554
|
break;
|
545
555
|
case constants_1.InteractionCallbackType.Modal:
|
546
556
|
{
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
title: options.data?.title,
|
556
|
-
},
|
557
|
+
json = {
|
558
|
+
type: options.type,
|
559
|
+
data: {
|
560
|
+
custom_id: options.data?.customID,
|
561
|
+
components: options.data?.components !== undefined
|
562
|
+
? transformers_1.Messages.componentsToRaw(options.data.components)
|
563
|
+
: undefined,
|
564
|
+
title: options.data?.title,
|
557
565
|
},
|
558
|
-
}
|
566
|
+
};
|
559
567
|
}
|
560
568
|
break;
|
561
569
|
case constants_1.InteractionCallbackType.PremiumRequired:
|
570
|
+
case constants_1.InteractionCallbackType.LaunchActivity:
|
562
571
|
{
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
},
|
568
|
-
});
|
572
|
+
json = {
|
573
|
+
type: options.type,
|
574
|
+
data: {},
|
575
|
+
};
|
569
576
|
}
|
570
577
|
break;
|
571
578
|
}
|
579
|
+
if (options.withResponse) {
|
580
|
+
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.interactionCallback(interactionID, interactionToken), {
|
581
|
+
json,
|
582
|
+
query: {
|
583
|
+
with_response: options.withResponse,
|
584
|
+
},
|
585
|
+
files,
|
586
|
+
});
|
587
|
+
return transformers_1.Interactions.interactionCallbackResponseFromRaw(response);
|
588
|
+
}
|
589
|
+
else {
|
590
|
+
this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.interactionCallback(interactionID, interactionToken), {
|
591
|
+
json,
|
592
|
+
query: {
|
593
|
+
with_response: options.withResponse,
|
594
|
+
},
|
595
|
+
files,
|
596
|
+
});
|
597
|
+
}
|
572
598
|
}
|
573
599
|
/** https://discord.com/developers/docs/resources/message#create-message */
|
574
600
|
async createMessage(channelID, options) {
|
@@ -774,6 +800,12 @@ class Client extends node_events_1.default {
|
|
774
800
|
reason,
|
775
801
|
});
|
776
802
|
}
|
803
|
+
/** https://discord.com/developers/docs/resources/soundboard#delete-guild-soundboard-sound */
|
804
|
+
deleteGuildSoundboardSound(guildID, soundID, reason) {
|
805
|
+
this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildSoundboardSound(guildID, soundID), {
|
806
|
+
reason,
|
807
|
+
});
|
808
|
+
}
|
777
809
|
/** https://discord.com/developers/docs/resources/guild-template#delete-guild-template */
|
778
810
|
async deleteGuildTemplate(guildID, code) {
|
779
811
|
const response = await this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.guildTemplate(guildID, code));
|
@@ -1180,6 +1212,19 @@ class Client extends node_events_1.default {
|
|
1180
1212
|
});
|
1181
1213
|
return transformers_1.Stickers.stickerFromRaw(response);
|
1182
1214
|
}
|
1215
|
+
/** https://discord.com/developers/docs/resources/soundboard#edit-guild-soundboard-sound */
|
1216
|
+
async editGuildSoundboardSound(guildID, soundID, options, reason) {
|
1217
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildSoundboardSound(guildID, soundID), {
|
1218
|
+
json: {
|
1219
|
+
name: options.name,
|
1220
|
+
volume: options.volume,
|
1221
|
+
emoji_id: options.emojiID,
|
1222
|
+
emoji_name: options.emojiName,
|
1223
|
+
},
|
1224
|
+
reason,
|
1225
|
+
});
|
1226
|
+
return transformers_1.Soundboards.soundboardSoundFromRaw(response);
|
1227
|
+
}
|
1183
1228
|
/** https://discord.com/developers/docs/resources/guild-template#modify-guild-template */
|
1184
1229
|
async editGuildTemplate(guildID, code, options) {
|
1185
1230
|
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildTemplate(guildID, code), {
|
@@ -1309,6 +1354,20 @@ class Client extends node_events_1.default {
|
|
1309
1354
|
waveform: attachment.waveform,
|
1310
1355
|
flags: attachment.flags,
|
1311
1356
|
})),
|
1357
|
+
poll: options.poll !== undefined
|
1358
|
+
? options.poll !== null
|
1359
|
+
? {
|
1360
|
+
question: options.poll.question,
|
1361
|
+
answers: options.poll.answers.map((answer) => ({
|
1362
|
+
answer_id: answer.answerID,
|
1363
|
+
poll_media: answer.pollMedia,
|
1364
|
+
})),
|
1365
|
+
duration: options.poll.duration,
|
1366
|
+
allow_multiselect: options.poll.allowMultiselect,
|
1367
|
+
layout_type: options.poll.layoutType,
|
1368
|
+
}
|
1369
|
+
: null
|
1370
|
+
: undefined,
|
1312
1371
|
},
|
1313
1372
|
files: options.files,
|
1314
1373
|
query: {
|
@@ -1356,6 +1415,20 @@ class Client extends node_events_1.default {
|
|
1356
1415
|
waveform: attachment.waveform,
|
1357
1416
|
flags: attachment.flags,
|
1358
1417
|
})),
|
1418
|
+
poll: options.poll !== undefined
|
1419
|
+
? options.poll !== null
|
1420
|
+
? {
|
1421
|
+
question: options.poll.question,
|
1422
|
+
answers: options.poll.answers.map((answer) => ({
|
1423
|
+
answer_id: answer.answerID,
|
1424
|
+
poll_media: answer.pollMedia,
|
1425
|
+
})),
|
1426
|
+
duration: options.poll.duration,
|
1427
|
+
allow_multiselect: options.poll.allowMultiselect,
|
1428
|
+
layout_type: options.poll.layoutType,
|
1429
|
+
}
|
1430
|
+
: null
|
1431
|
+
: undefined,
|
1359
1432
|
},
|
1360
1433
|
files: options.files,
|
1361
1434
|
query: {
|
@@ -1424,6 +1497,20 @@ class Client extends node_events_1.default {
|
|
1424
1497
|
waveform: attachment.waveform,
|
1425
1498
|
flags: attachment.flags,
|
1426
1499
|
})),
|
1500
|
+
poll: options.poll !== undefined
|
1501
|
+
? options.poll !== null
|
1502
|
+
? {
|
1503
|
+
question: options.poll.question,
|
1504
|
+
answers: options.poll.answers.map((answer) => ({
|
1505
|
+
answer_id: answer.answerID,
|
1506
|
+
poll_media: answer.pollMedia,
|
1507
|
+
})),
|
1508
|
+
duration: options.poll.duration,
|
1509
|
+
allow_multiselect: options.poll.allowMultiselect,
|
1510
|
+
layout_type: options.poll.layoutType,
|
1511
|
+
}
|
1512
|
+
: null
|
1513
|
+
: undefined,
|
1427
1514
|
},
|
1428
1515
|
files: options.files,
|
1429
1516
|
query: {
|
@@ -1665,6 +1752,11 @@ class Client extends node_events_1.default {
|
|
1665
1752
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildVoiceState(guildID));
|
1666
1753
|
return transformers_1.Voice.voiceStateFromRaw(response);
|
1667
1754
|
}
|
1755
|
+
/** https://discord.com/developers/docs/resources/soundboard#list-default-soundboard-sounds */
|
1756
|
+
async getDefaultSoundboardSounds() {
|
1757
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.soundboardDefaultSounds());
|
1758
|
+
return response.map((sound) => transformers_1.Soundboards.soundboardSoundFromRaw(sound));
|
1759
|
+
}
|
1668
1760
|
/** https://discord.com/developers/docs/resources/entitlement#list-entitlements */
|
1669
1761
|
async getEntitlements(applicationID, options) {
|
1670
1762
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationEntitlements(applicationID), {
|
@@ -1918,6 +2010,17 @@ class Client extends node_events_1.default {
|
|
1918
2010
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildStickers(guildID));
|
1919
2011
|
return response.map((sticker) => transformers_1.Stickers.stickerFromRaw(sticker));
|
1920
2012
|
}
|
2013
|
+
/** https://discord.com/developers/docs/resources/soundboard#get-guild-soundboard-sound */
|
2014
|
+
async getGuildSoundboardSound(guildID, soundID) {
|
2015
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildSoundboardSound(guildID, soundID));
|
2016
|
+
return transformers_1.Soundboards.soundboardSoundFromRaw(response);
|
2017
|
+
}
|
2018
|
+
async getGuildSoundboardSounds(guildID) {
|
2019
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildSoundboardSounds(guildID));
|
2020
|
+
return {
|
2021
|
+
items: response.items.map((sound) => transformers_1.Soundboards.soundboardSoundFromRaw(sound)),
|
2022
|
+
};
|
2023
|
+
}
|
1921
2024
|
/** https://discord.com/developers/docs/resources/guild-template#get-guild-template */
|
1922
2025
|
async getGuildTemplate(guildID, code) {
|
1923
2026
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildTemplate(guildID, code));
|
@@ -2271,6 +2374,15 @@ class Client extends node_events_1.default {
|
|
2271
2374
|
});
|
2272
2375
|
return response.map((guildMember) => transformers_1.Guilds.guildMemberFromRaw(guildMember));
|
2273
2376
|
}
|
2377
|
+
/** https://discord.com/developers/docs/resources/soundboard#send-soundboard-sound */
|
2378
|
+
sendSoundboardSound(channelID, options) {
|
2379
|
+
this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.sendSoundboardSound(channelID), {
|
2380
|
+
json: {
|
2381
|
+
sound_id: options.soundID,
|
2382
|
+
source_guild_id: options.sourceGuildID,
|
2383
|
+
},
|
2384
|
+
});
|
2385
|
+
}
|
2274
2386
|
/** https://discord.com/developers/docs/topics/gateway-events#update-presence */
|
2275
2387
|
setPresence(options) {
|
2276
2388
|
this.shards.forEach((shard) => shard.updatePresence(options));
|