disgroove 2.2.7-dev.64580a3 → 2.2.7-dev.704bd88
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 +43 -8
- package/dist/lib/Client.js +71 -17
- package/dist/lib/constants.d.ts +5 -0
- package/dist/lib/constants.js +7 -1
- package/dist/lib/gateway/Shard.js +1 -0
- package/dist/lib/rest/Endpoints.d.ts +4 -0
- package/dist/lib/rest/Endpoints.js +10 -1
- package/dist/lib/transformers/Components.d.ts +2 -2
- package/dist/lib/transformers/Components.js +78 -28
- package/dist/lib/transformers/Interactions.js +260 -9
- package/dist/lib/transformers/Lobbies.d.ts +7 -0
- package/dist/lib/transformers/Lobbies.js +38 -0
- package/dist/lib/transformers/Messages.d.ts +3 -3
- package/dist/lib/transformers/Messages.js +0 -28
- package/dist/lib/transformers/Roles.js +2 -2
- package/dist/lib/transformers/index.d.ts +2 -1
- package/dist/lib/transformers/index.js +2 -1
- package/dist/lib/types/gateway-events.d.ts +3 -1
- package/dist/lib/types/guild.d.ts +7 -5
- package/dist/lib/types/interaction.d.ts +15 -5
- package/dist/lib/types/lobby.d.ts +29 -0
- package/dist/lib/types/lobby.js +2 -0
- package/dist/lib/types/message-components.d.ts +121 -2
- package/dist/lib/types/message.d.ts +3 -3
- package/dist/lib/types/role.d.ts +2 -2
- package/dist/lib/utils/formatters.d.ts +1 -1
- package/dist/lib/utils/formatters.js +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/lib/Client.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
/// <reference types="node" />
|
|
4
|
-
import { GatewayIntents, type OAuth2Scopes, type ActionTypes, type ImageWidgetStyleOptions, 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";
|
|
4
|
+
import { GatewayIntents, type OAuth2Scopes, type ActionTypes, type ImageWidgetStyleOptions, 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, type LobbyMemberFlags } from "./constants";
|
|
5
5
|
import { RequestManager, type FileData } from "./rest";
|
|
6
6
|
import EventEmitter from "node:events";
|
|
7
7
|
import { Shard } from "./gateway";
|
|
@@ -33,6 +33,7 @@ import type { Embed, AllowedMentions, Attachment, Message, MessageReference, Mes
|
|
|
33
33
|
import type { Subscription } from "./types/subscription";
|
|
34
34
|
import type { SoundboardSound } from "./types/soundboard";
|
|
35
35
|
import type { ActionRow, Button, ChannelSelect, Container, File, MediaGallery, MentionableSelect, RoleSelect, Section, Separator, StringSelect, TextDisplay, Thumbnail, UserSelect } from "./types/message-components";
|
|
36
|
+
import type { Lobby, LobbyMember } from "./types/lobby";
|
|
36
37
|
export interface GatewayOptions {
|
|
37
38
|
properties?: IdentifyConnectionProperties;
|
|
38
39
|
compress?: boolean;
|
|
@@ -78,6 +79,11 @@ export declare class Client extends EventEmitter {
|
|
|
78
79
|
}): Promise<GuildMember | null>;
|
|
79
80
|
/** https://discord.com/developers/docs/resources/guild#add-guild-member-role */
|
|
80
81
|
addGuildMemberRole(guildID: snowflake, userID: snowflake, roleID: snowflake, reason?: string): void;
|
|
82
|
+
/** https://discord.com/developers/docs/resources/lobby#add-a-member-to-a-lobby */
|
|
83
|
+
addLobbyMember(lobbyID: snowflake, userID: snowflake, options: {
|
|
84
|
+
metadata?: Record<string, string> | null;
|
|
85
|
+
flags?: LobbyMemberFlags;
|
|
86
|
+
}): Promise<LobbyMember>;
|
|
81
87
|
/** https://discord.com/developers/docs/resources/channel#add-thread-member */
|
|
82
88
|
addThreadMember(channelID: snowflake, userID: snowflake): void;
|
|
83
89
|
/** https://discord.com/developers/docs/resources/guild#begin-guild-prune */
|
|
@@ -276,7 +282,7 @@ export declare class Client extends EventEmitter {
|
|
|
276
282
|
tts?: boolean;
|
|
277
283
|
embeds?: Array<Embed>;
|
|
278
284
|
allowedMentions?: AllowedMentions;
|
|
279
|
-
components?: Array<ActionRow |
|
|
285
|
+
components?: Array<ActionRow | Section | TextDisplay | MediaGallery | File | Separator | Container>;
|
|
280
286
|
files?: Array<FileData> | null;
|
|
281
287
|
attachments?: Array<Pick<Attachment, "filename" | "description">>;
|
|
282
288
|
flags?: MessageFlags;
|
|
@@ -288,6 +294,12 @@ export declare class Client extends EventEmitter {
|
|
|
288
294
|
createInteractionResponse(interactionID: snowflake, interactionToken: string, options: InteractionResponse & {
|
|
289
295
|
withResponse?: boolean;
|
|
290
296
|
}): Promise<void | InteractionCallbackResponse>;
|
|
297
|
+
/** https://discord.com/developers/docs/resources/lobby#create-lobby */
|
|
298
|
+
createLobby(options: {
|
|
299
|
+
metadata?: Record<string, string> | null;
|
|
300
|
+
members?: Array<Pick<LobbyMember, "id" | "metadata" | "flags">>;
|
|
301
|
+
idleTimeoutSeconds?: number;
|
|
302
|
+
}): Promise<Lobby>;
|
|
291
303
|
/** https://discord.com/developers/docs/resources/message#create-message */
|
|
292
304
|
createMessage(channelID: snowflake, options: {
|
|
293
305
|
content?: string;
|
|
@@ -296,7 +308,7 @@ export declare class Client extends EventEmitter {
|
|
|
296
308
|
embeds?: Array<Embed>;
|
|
297
309
|
allowedMentions?: AllowedMentions;
|
|
298
310
|
messageReference?: MessageReference;
|
|
299
|
-
components?: Array<ActionRow |
|
|
311
|
+
components?: Array<ActionRow | Section | TextDisplay | MediaGallery | File | Separator | Container>;
|
|
300
312
|
stickersIDs?: Array<snowflake>;
|
|
301
313
|
files?: Array<FileData>;
|
|
302
314
|
attachments?: Array<Pick<Attachment, "filename" | "description">>;
|
|
@@ -387,6 +399,8 @@ export declare class Client extends EventEmitter {
|
|
|
387
399
|
deleteInteractionFollowupMessage(applicationID: snowflake, interactionToken: string, messageID: snowflake): void;
|
|
388
400
|
/** https://discord.com/developers/docs/interactions/receiving-and-responding#delete-original-interaction-response */
|
|
389
401
|
deleteInteractionResponse(applicationID: snowflake, interactionToken: string): void;
|
|
402
|
+
/** https://discord.com/developers/docs/resources/lobby#delete-lobby */
|
|
403
|
+
deleteLobby(lobbyID: snowflake): void;
|
|
390
404
|
/** https://discord.com/developers/docs/resources/message#delete-message */
|
|
391
405
|
deleteMessage(channelID: snowflake, messageID: snowflake, reason?: string): void;
|
|
392
406
|
/** https://discord.com/developers/docs/resources/message#delete-user-reaction */
|
|
@@ -473,6 +487,9 @@ export declare class Client extends EventEmitter {
|
|
|
473
487
|
/** https://discord.com/developers/docs/resources/guild#modify-current-member */
|
|
474
488
|
editCurrentGuildMember(guildID: snowflake, options: {
|
|
475
489
|
nick?: string | null;
|
|
490
|
+
banner?: string | null;
|
|
491
|
+
avatar?: string | null;
|
|
492
|
+
bio?: string | null;
|
|
476
493
|
}, reason?: string): Promise<GuildMember>;
|
|
477
494
|
/** https://discord.com/developers/docs/resources/guild#modify-current-user-voice-state */
|
|
478
495
|
editCurrentUserVoiceState(guildID: snowflake, options: {
|
|
@@ -623,13 +640,19 @@ export declare class Client extends EventEmitter {
|
|
|
623
640
|
enabled?: boolean;
|
|
624
641
|
channelID?: boolean;
|
|
625
642
|
}, reason?: string): Promise<GuildWidgetSettings>;
|
|
643
|
+
/** https://discord.com/developers/docs/resources/lobby#modify-lobby */
|
|
644
|
+
editLobby(lobbyID: snowflake, options: {
|
|
645
|
+
metadata?: Record<string, string> | null;
|
|
646
|
+
members?: Array<Pick<LobbyMember, "id" | "metadata" | "flags">>;
|
|
647
|
+
idleTimeoutSeconds?: number;
|
|
648
|
+
}): Promise<Lobby>;
|
|
626
649
|
/** https://discord.com/developers/docs/resources/message#edit-message */
|
|
627
650
|
editMessage(channelID: snowflake, messageID: snowflake, options: {
|
|
628
651
|
content?: string | null;
|
|
629
652
|
embeds?: Array<Embed> | null;
|
|
630
653
|
flags?: MessageFlags | null;
|
|
631
654
|
allowedMentions?: AllowedMentions | null;
|
|
632
|
-
components?: Array<ActionRow |
|
|
655
|
+
components?: Array<ActionRow | Section | TextDisplay | MediaGallery | File | Separator | Container> | null;
|
|
633
656
|
files?: Array<FileData> | null;
|
|
634
657
|
attachments?: Array<Attachment> | null;
|
|
635
658
|
}): Promise<Message>;
|
|
@@ -643,7 +666,7 @@ export declare class Client extends EventEmitter {
|
|
|
643
666
|
content?: string | null;
|
|
644
667
|
embeds?: Array<Embed> | null;
|
|
645
668
|
allowedMentions?: AllowedMentions | null;
|
|
646
|
-
components?: Array<ActionRow |
|
|
669
|
+
components?: Array<ActionRow | Section | TextDisplay | MediaGallery | File | Separator | Container> | null;
|
|
647
670
|
files?: Array<FileData> | null;
|
|
648
671
|
attachments?: Array<Partial<Attachment>> | null;
|
|
649
672
|
poll?: PollCreateParams | null;
|
|
@@ -654,7 +677,7 @@ export declare class Client extends EventEmitter {
|
|
|
654
677
|
content?: string | null;
|
|
655
678
|
embeds?: Array<Embed> | null;
|
|
656
679
|
allowedMentions?: AllowedMentions | null;
|
|
657
|
-
components?: Array<ActionRow |
|
|
680
|
+
components?: Array<ActionRow | Section | TextDisplay | MediaGallery | File | Separator | Container> | null;
|
|
658
681
|
files?: Array<FileData> | null;
|
|
659
682
|
attachments?: Array<Partial<Attachment>> | null;
|
|
660
683
|
poll?: PollCreateParams | null;
|
|
@@ -676,7 +699,7 @@ export declare class Client extends EventEmitter {
|
|
|
676
699
|
content?: string | null;
|
|
677
700
|
embeds?: Array<Embed> | null;
|
|
678
701
|
allowedMentions?: AllowedMentions | null;
|
|
679
|
-
components?: Array<ActionRow |
|
|
702
|
+
components?: Array<ActionRow | Section | TextDisplay | MediaGallery | File | Separator | Container> | null;
|
|
680
703
|
files?: Array<FileData> | null;
|
|
681
704
|
attachments?: Array<Partial<Attachment>> | null;
|
|
682
705
|
poll?: PollCreateParams | null;
|
|
@@ -698,7 +721,7 @@ export declare class Client extends EventEmitter {
|
|
|
698
721
|
tts?: boolean;
|
|
699
722
|
embeds?: Array<Embed>;
|
|
700
723
|
allowedMentions?: AllowedMentions;
|
|
701
|
-
components?: Array<ActionRow |
|
|
724
|
+
components?: Array<ActionRow | Section | TextDisplay | MediaGallery | File | Separator | Container>;
|
|
702
725
|
files?: Array<FileData>;
|
|
703
726
|
attachments?: Array<Pick<Attachment, "filename" | "description">>;
|
|
704
727
|
flags?: MessageFlags;
|
|
@@ -934,6 +957,8 @@ export declare class Client extends EventEmitter {
|
|
|
934
957
|
members: Array<ThreadMember>;
|
|
935
958
|
hasMore: boolean;
|
|
936
959
|
}>;
|
|
960
|
+
/** https://discord.com/developers/docs/resources/lobby#get-lobby */
|
|
961
|
+
getLobby(lobbyID: snowflake): Promise<Lobby>;
|
|
937
962
|
/** https://discord.com/developers/docs/resources/message#get-channel-message */
|
|
938
963
|
getMessage(channelID: snowflake, messageID: snowflake): Promise<Message>;
|
|
939
964
|
/** https://discord.com/developers/docs/resources/message#get-reactions */
|
|
@@ -1023,10 +1048,16 @@ export declare class Client extends EventEmitter {
|
|
|
1023
1048
|
}): void;
|
|
1024
1049
|
/** https://discord.com/developers/docs/resources/user#leave-guild */
|
|
1025
1050
|
leaveGuild(guildID: snowflake): void;
|
|
1051
|
+
/** https://discord.com/developers/docs/resources/lobby#leave-lobby */
|
|
1052
|
+
leaveLobby(lobbyID: snowflake): void;
|
|
1026
1053
|
/** https://discord.com/developers/docs/resources/channel#leave-thread */
|
|
1027
1054
|
leaveThread(channelID: snowflake): void;
|
|
1028
1055
|
/** https://discord.com/developers/docs/topics/gateway-events#update-voice-state */
|
|
1029
1056
|
leaveVoiceChannel(guildID: snowflake): void;
|
|
1057
|
+
/** discord.com/developers/docs/resources/lobby#link-channel-to-lobby */
|
|
1058
|
+
linkChannel(lobbyID: snowflake, options: {
|
|
1059
|
+
channelID: snowflake;
|
|
1060
|
+
}): Promise<Lobby>;
|
|
1030
1061
|
/** https://discord.com/developers/docs/resources/channel#pin-message */
|
|
1031
1062
|
pinMessage(channelID: snowflake, messageID: snowflake, reason?: string): void;
|
|
1032
1063
|
/** https://discord.com/developers/docs/resources/guild#remove-guild-ban */
|
|
@@ -1037,6 +1068,8 @@ export declare class Client extends EventEmitter {
|
|
|
1037
1068
|
removeGuildMember(guildID: snowflake, userID: snowflake, reason?: string): void;
|
|
1038
1069
|
/** https://discord.com/developers/docs/resources/guild#remove-guild-member-role */
|
|
1039
1070
|
removeGuildMemberRole(guildID: snowflake, userID: snowflake, roleID: snowflake, reason?: string): void;
|
|
1071
|
+
/** https://discord.com/developers/docs/resources/lobby#remove-a-member-from-a-lobby */
|
|
1072
|
+
removeLobbyMember(lobbyID: snowflake, userID: snowflake): void;
|
|
1040
1073
|
/** https://discord.com/developers/docs/resources/channel#remove-thread-member */
|
|
1041
1074
|
removeThreadMember(channelID: snowflake, userID: snowflake): void;
|
|
1042
1075
|
/** https://discord.com/developers/docs/resources/guild#search-guild-members */
|
|
@@ -1055,6 +1088,8 @@ export declare class Client extends EventEmitter {
|
|
|
1055
1088
|
syncGuildTemplate(guildID: snowflake, code: string): Promise<GuildTemplate>;
|
|
1056
1089
|
/** https://discord.com/developers/docs/resources/channel#trigger-typing-indicator */
|
|
1057
1090
|
triggerTypingIndicator(channelID: snowflake): void;
|
|
1091
|
+
/** https://discord.com/developers/docs/resources/lobby#unlink-channel-from-lobby */
|
|
1092
|
+
unlinkChannel(lobbyID: snowflake): Promise<Lobby>;
|
|
1058
1093
|
/** https://discord.com/developers/docs/resources/application-role-connection-metadata#update-application-role-connection-metadata-records */
|
|
1059
1094
|
updateApplicationRoleConnectionMetadataRecords(applicationID: snowflake): Promise<Array<ApplicationRoleConnectionMetadata>>;
|
|
1060
1095
|
/** https://discord.com/developers/docs/resources/user#update-current-user-application-role-connection */
|
package/dist/lib/Client.js
CHANGED
|
@@ -76,6 +76,13 @@ class Client extends node_events_1.default {
|
|
|
76
76
|
reason,
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
|
+
/** https://discord.com/developers/docs/resources/lobby#add-a-member-to-a-lobby */
|
|
80
|
+
async addLobbyMember(lobbyID, userID, options) {
|
|
81
|
+
const response = await this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.lobbyMember(lobbyID, userID), {
|
|
82
|
+
json: options,
|
|
83
|
+
});
|
|
84
|
+
return transformers_1.Lobbies.lobbyMemberFromRaw(response);
|
|
85
|
+
}
|
|
79
86
|
/** https://discord.com/developers/docs/resources/channel#add-thread-member */
|
|
80
87
|
addThreadMember(channelID, userID) {
|
|
81
88
|
this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.threadMembers(channelID, userID));
|
|
@@ -333,6 +340,11 @@ class Client extends node_events_1.default {
|
|
|
333
340
|
name: options.name,
|
|
334
341
|
permissions: options.permissions,
|
|
335
342
|
color: options.color,
|
|
343
|
+
colors: {
|
|
344
|
+
primary_color: options.colors?.primaryColor,
|
|
345
|
+
secondary_color: options.colors?.secondaryColor,
|
|
346
|
+
tertiary_color: options.colors?.tertiaryColor,
|
|
347
|
+
},
|
|
336
348
|
hoist: options.hoist,
|
|
337
349
|
icon: options.icon,
|
|
338
350
|
unicode_emoji: options.unicodeEmoji,
|
|
@@ -469,24 +481,10 @@ class Client extends node_events_1.default {
|
|
|
469
481
|
switch (component.type) {
|
|
470
482
|
case constants_1.ComponentTypes.ActionRow:
|
|
471
483
|
return transformers_1.Components.actionRowToRaw(component);
|
|
472
|
-
case constants_1.ComponentTypes.Button:
|
|
473
|
-
return transformers_1.Components.buttonToRaw(component);
|
|
474
|
-
case constants_1.ComponentTypes.StringSelect:
|
|
475
|
-
return transformers_1.Components.stringSelectToRaw(component);
|
|
476
|
-
case constants_1.ComponentTypes.UserSelect:
|
|
477
|
-
return transformers_1.Components.userSelectToRaw(component);
|
|
478
|
-
case constants_1.ComponentTypes.RoleSelect:
|
|
479
|
-
return transformers_1.Components.roleSelectToRaw(component);
|
|
480
|
-
case constants_1.ComponentTypes.MentionableSelect:
|
|
481
|
-
return transformers_1.Components.mentionableSelectToRaw(component);
|
|
482
|
-
case constants_1.ComponentTypes.ChannelSelect:
|
|
483
|
-
return transformers_1.Components.channelSelectToRaw(component);
|
|
484
484
|
case constants_1.ComponentTypes.Section:
|
|
485
485
|
return transformers_1.Components.sectionToRaw(component);
|
|
486
486
|
case constants_1.ComponentTypes.TextDisplay:
|
|
487
487
|
return transformers_1.Components.textDisplayToRaw(component);
|
|
488
|
-
case constants_1.ComponentTypes.Thumbnail:
|
|
489
|
-
return transformers_1.Components.thumbnailToRaw(component);
|
|
490
488
|
case constants_1.ComponentTypes.MediaGallery:
|
|
491
489
|
return transformers_1.Components.mediaGalleryToRaw(component);
|
|
492
490
|
case constants_1.ComponentTypes.File:
|
|
@@ -594,6 +592,17 @@ class Client extends node_events_1.default {
|
|
|
594
592
|
});
|
|
595
593
|
}
|
|
596
594
|
}
|
|
595
|
+
/** https://discord.com/developers/docs/resources/lobby#create-lobby */
|
|
596
|
+
async createLobby(options) {
|
|
597
|
+
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.lobbies(), {
|
|
598
|
+
json: {
|
|
599
|
+
metadata: options.metadata,
|
|
600
|
+
members: options.members,
|
|
601
|
+
idle_timeout_seconds: options.idleTimeoutSeconds,
|
|
602
|
+
},
|
|
603
|
+
});
|
|
604
|
+
return transformers_1.Lobbies.lobbyFromRaw(response);
|
|
605
|
+
}
|
|
597
606
|
/** https://discord.com/developers/docs/resources/message#create-message */
|
|
598
607
|
async createMessage(channelID, options) {
|
|
599
608
|
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.channelMessages(channelID), {
|
|
@@ -820,6 +829,10 @@ class Client extends node_events_1.default {
|
|
|
820
829
|
deleteInteractionResponse(applicationID, interactionToken) {
|
|
821
830
|
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.webhookMessage(applicationID, interactionToken));
|
|
822
831
|
}
|
|
832
|
+
/** https://discord.com/developers/docs/resources/lobby#delete-lobby */
|
|
833
|
+
deleteLobby(lobbyID) {
|
|
834
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.lobby(lobbyID));
|
|
835
|
+
}
|
|
823
836
|
/** https://discord.com/developers/docs/resources/message#delete-message */
|
|
824
837
|
deleteMessage(channelID, messageID, reason) {
|
|
825
838
|
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.channelMessage(channelID, messageID), {
|
|
@@ -976,9 +989,7 @@ class Client extends node_events_1.default {
|
|
|
976
989
|
/** https://discord.com/developers/docs/resources/guild#modify-current-member */
|
|
977
990
|
async editCurrentGuildMember(guildID, options, reason) {
|
|
978
991
|
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.guildMember(guildID), {
|
|
979
|
-
json:
|
|
980
|
-
nick: options.nick,
|
|
981
|
-
},
|
|
992
|
+
json: options,
|
|
982
993
|
reason,
|
|
983
994
|
});
|
|
984
995
|
return transformers_1.Guilds.guildMemberFromRaw(response);
|
|
@@ -1159,6 +1170,11 @@ class Client extends node_events_1.default {
|
|
|
1159
1170
|
name: options?.name,
|
|
1160
1171
|
permissions: options?.permissions,
|
|
1161
1172
|
color: options?.color,
|
|
1173
|
+
colors: {
|
|
1174
|
+
primary_color: options?.colors?.primaryColor,
|
|
1175
|
+
secondary_color: options?.colors?.secondaryColor,
|
|
1176
|
+
tertiary_color: options?.colors?.tertiaryColor,
|
|
1177
|
+
},
|
|
1162
1178
|
hoist: options?.hoist,
|
|
1163
1179
|
icon: options?.icon,
|
|
1164
1180
|
unicode_emoji: options?.unicodeEmoji,
|
|
@@ -1274,6 +1290,17 @@ class Client extends node_events_1.default {
|
|
|
1274
1290
|
channelID: response.channel_id,
|
|
1275
1291
|
};
|
|
1276
1292
|
}
|
|
1293
|
+
/** https://discord.com/developers/docs/resources/lobby#modify-lobby */
|
|
1294
|
+
async editLobby(lobbyID, options) {
|
|
1295
|
+
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.lobby(lobbyID), {
|
|
1296
|
+
json: {
|
|
1297
|
+
metadata: options.metadata,
|
|
1298
|
+
members: options.members,
|
|
1299
|
+
idle_timeout_seconds: options.idleTimeoutSeconds,
|
|
1300
|
+
},
|
|
1301
|
+
});
|
|
1302
|
+
return transformers_1.Lobbies.lobbyFromRaw(response);
|
|
1303
|
+
}
|
|
1277
1304
|
/** https://discord.com/developers/docs/resources/message#edit-message */
|
|
1278
1305
|
async editMessage(channelID, messageID, options) {
|
|
1279
1306
|
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.channelMessage(channelID, messageID), {
|
|
@@ -2142,6 +2169,11 @@ class Client extends node_events_1.default {
|
|
|
2142
2169
|
hasMore: response.has_more,
|
|
2143
2170
|
};
|
|
2144
2171
|
}
|
|
2172
|
+
/** https://discord.com/developers/docs/resources/lobby#get-lobby */
|
|
2173
|
+
async getLobby(lobbyID) {
|
|
2174
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.lobby(lobbyID));
|
|
2175
|
+
return transformers_1.Lobbies.lobbyFromRaw(response);
|
|
2176
|
+
}
|
|
2145
2177
|
/** https://discord.com/developers/docs/resources/message#get-channel-message */
|
|
2146
2178
|
async getMessage(channelID, messageID) {
|
|
2147
2179
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channelMessage(channelID, messageID));
|
|
@@ -2339,6 +2371,10 @@ class Client extends node_events_1.default {
|
|
|
2339
2371
|
leaveGuild(guildID) {
|
|
2340
2372
|
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.userGuild(guildID));
|
|
2341
2373
|
}
|
|
2374
|
+
/** https://discord.com/developers/docs/resources/lobby#leave-lobby */
|
|
2375
|
+
leaveLobby(lobbyID) {
|
|
2376
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.lobbyMember(lobbyID));
|
|
2377
|
+
}
|
|
2342
2378
|
/** https://discord.com/developers/docs/resources/channel#leave-thread */
|
|
2343
2379
|
leaveThread(channelID) {
|
|
2344
2380
|
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.threadMembers(channelID, "@me"));
|
|
@@ -2352,6 +2388,15 @@ class Client extends node_events_1.default {
|
|
|
2352
2388
|
selfDeaf: false,
|
|
2353
2389
|
});
|
|
2354
2390
|
}
|
|
2391
|
+
/** discord.com/developers/docs/resources/lobby#link-channel-to-lobby */
|
|
2392
|
+
async linkChannel(lobbyID, options) {
|
|
2393
|
+
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.lobbyChannelLinking(lobbyID), {
|
|
2394
|
+
json: {
|
|
2395
|
+
channel_id: options.channelID,
|
|
2396
|
+
},
|
|
2397
|
+
});
|
|
2398
|
+
return transformers_1.Lobbies.lobbyFromRaw(response);
|
|
2399
|
+
}
|
|
2355
2400
|
/** https://discord.com/developers/docs/resources/channel#pin-message */
|
|
2356
2401
|
pinMessage(channelID, messageID, reason) {
|
|
2357
2402
|
this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.channelPin(channelID, messageID), {
|
|
@@ -2380,6 +2425,10 @@ class Client extends node_events_1.default {
|
|
|
2380
2425
|
reason,
|
|
2381
2426
|
});
|
|
2382
2427
|
}
|
|
2428
|
+
/** https://discord.com/developers/docs/resources/lobby#remove-a-member-from-a-lobby */
|
|
2429
|
+
removeLobbyMember(lobbyID, userID) {
|
|
2430
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.lobbyMember(lobbyID, userID));
|
|
2431
|
+
}
|
|
2383
2432
|
/** https://discord.com/developers/docs/resources/channel#remove-thread-member */
|
|
2384
2433
|
removeThreadMember(channelID, userID) {
|
|
2385
2434
|
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.threadMembers(channelID, userID));
|
|
@@ -2416,6 +2465,11 @@ class Client extends node_events_1.default {
|
|
|
2416
2465
|
triggerTypingIndicator(channelID) {
|
|
2417
2466
|
this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.channelTyping(channelID));
|
|
2418
2467
|
}
|
|
2468
|
+
/** https://discord.com/developers/docs/resources/lobby#unlink-channel-from-lobby */
|
|
2469
|
+
async unlinkChannel(lobbyID) {
|
|
2470
|
+
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.lobbyChannelLinking(lobbyID));
|
|
2471
|
+
return transformers_1.Lobbies.lobbyFromRaw(response);
|
|
2472
|
+
}
|
|
2419
2473
|
/** https://discord.com/developers/docs/resources/application-role-connection-metadata#update-application-role-connection-metadata-records */
|
|
2420
2474
|
async updateApplicationRoleConnectionMetadataRecords(applicationID) {
|
|
2421
2475
|
const response = await this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.applicationRoleConnectionMetadata(applicationID));
|
package/dist/lib/constants.d.ts
CHANGED
|
@@ -519,6 +519,10 @@ export declare enum InviteTargetTypes {
|
|
|
519
519
|
export declare enum GuildInviteFlags {
|
|
520
520
|
IsGuestInvite = 1
|
|
521
521
|
}
|
|
522
|
+
/** https://discord.com/developers/docs/resources/lobby#lobby-member-object-lobby-member-flags */
|
|
523
|
+
export declare enum LobbyMemberFlags {
|
|
524
|
+
CanLinkLobby = 1
|
|
525
|
+
}
|
|
522
526
|
/** https://discord.com/developers/docs/resources/message#message-object-message-types */
|
|
523
527
|
export declare enum MessageTypes {
|
|
524
528
|
Default = 0,
|
|
@@ -1175,6 +1179,7 @@ export declare enum JSONErrorCodes {
|
|
|
1175
1179
|
MessageBlockedByHarmfulLinksFilter = 240000,
|
|
1176
1180
|
CannotEnableOnboardingRequirementsAreNotMet = 350000,
|
|
1177
1181
|
CannotUpdateOnboardingWhileBelowRequirements = 350001,
|
|
1182
|
+
AccessToFileUploadsHasBeenLimitedForThisGuild = 400001,
|
|
1178
1183
|
FailedToBanUsers = 500000,
|
|
1179
1184
|
PollVotingBlocked = 520000,
|
|
1180
1185
|
PollExpired = 520001,
|
package/dist/lib/constants.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GuildScheduledEventRecurrenceRuleMonth = exports.GuildScheduledEventRecurrenceRuleWeekday = exports.GuildScheduledEventRecurrenceRuleFrequency = exports.GuildScheduledEventStatus = exports.GuildScheduledEventEntityTypes = exports.GuildScheduledEventPrivacyLevel = exports.ImageWidgetStyleOptions = exports.PromptTypes = exports.OnboardingMode = exports.IntegrationExpireBehaviors = exports.GuildMemberFlags = exports.MutableGuildFeatures = exports.GuildFeatures = exports.SystemChannelFlags = exports.PremiumTier = exports.GuildNSFWLevel = exports.VerificationLevel = exports.MFALevel = exports.ExplicitContentFilterLevel = exports.DefaultMessageNotificationLevel = exports.ForumLayoutTypes = exports.SortOrderTypes = exports.ChannelFlags = exports.VideoQualityModes = exports.ChannelTypes = exports.ActionTypes = exports.EventTypes = exports.KeywordPresetTypes = exports.TriggerTypes = exports.AuditLogEvents = exports.ApplicationRoleConnectionMetadataType = exports.ActivityLocationKind = exports.ApplicationFlags = exports.ApplicationEventWebhookStatus = exports.ApplicationIntegrationTypes = exports.SeparatorSpacing = exports.TextInputStyles = exports.ButtonStyles = exports.ComponentTypes = exports.InteractionCallbackType = exports.InteractionContextTypes = exports.InteractionType = exports.ApplicationCommandPermissionType = exports.EntryPointCommandHandlerTypes = exports.ApplicationCommandOptionType = exports.ApplicationCommandTypes = exports.Locales = exports.ImageFormats = exports.GuildNavigationTypes = exports.TimestampStyles = void 0;
|
|
4
|
-
exports.EntitlementTypes = exports.SKUFlags = exports.SKUTypes = exports.MembershipState = exports.TeamMemberRoleTypes = exports.RoleFlags = exports.BitwisePermissionFlags = exports.RPCCloseEventCodes = exports.RPCErrorCodes = exports.JSONErrorCodes = exports.HTTPResponseCodes = exports.VoiceCloseEventCodes = exports.VoiceOPCodes = exports.GatewayCloseEventCodes = exports.GatewayOPCodes = exports.OAuth2Scopes = exports.AnimationTypes = exports.ActivityFlags = exports.ActivityType = exports.GatewayEvents = exports.StatusTypes = exports.GatewayIntents = exports.DeviceType = exports.WebhookTypes = exports.SubscriptionStatuses = exports.VisibilityTypes = exports.Services = exports.PremiumTypes = exports.UserFlags = exports.StickerFormatTypes = exports.StickerTypes = exports.PrivacyLevel = exports.LayoutType = exports.ReactionTypes = exports.AllowedMentionTypes = exports.AttachmentFlags = exports.EmbedTypes = exports.MessageReferenceTypes = exports.MessageFlags = exports.MessageActivityTypes = exports.MessageTypes = exports.GuildInviteFlags = exports.InviteTargetTypes = exports.InviteTypes = void 0;
|
|
4
|
+
exports.EntitlementTypes = exports.SKUFlags = exports.SKUTypes = exports.MembershipState = exports.TeamMemberRoleTypes = exports.RoleFlags = exports.BitwisePermissionFlags = exports.RPCCloseEventCodes = exports.RPCErrorCodes = exports.JSONErrorCodes = exports.HTTPResponseCodes = exports.VoiceCloseEventCodes = exports.VoiceOPCodes = exports.GatewayCloseEventCodes = exports.GatewayOPCodes = exports.OAuth2Scopes = exports.AnimationTypes = exports.ActivityFlags = exports.ActivityType = exports.GatewayEvents = exports.StatusTypes = exports.GatewayIntents = exports.DeviceType = exports.WebhookTypes = exports.SubscriptionStatuses = exports.VisibilityTypes = exports.Services = exports.PremiumTypes = exports.UserFlags = exports.StickerFormatTypes = exports.StickerTypes = exports.PrivacyLevel = exports.LayoutType = exports.ReactionTypes = exports.AllowedMentionTypes = exports.AttachmentFlags = exports.EmbedTypes = exports.MessageReferenceTypes = exports.MessageFlags = exports.MessageActivityTypes = exports.MessageTypes = exports.LobbyMemberFlags = exports.GuildInviteFlags = exports.InviteTargetTypes = exports.InviteTypes = void 0;
|
|
5
5
|
/** https://discord.com/developers/docs/reference#message-formatting-timestamp-styles */
|
|
6
6
|
var TimestampStyles;
|
|
7
7
|
(function (TimestampStyles) {
|
|
@@ -576,6 +576,11 @@ var GuildInviteFlags;
|
|
|
576
576
|
(function (GuildInviteFlags) {
|
|
577
577
|
GuildInviteFlags[GuildInviteFlags["IsGuestInvite"] = 1] = "IsGuestInvite";
|
|
578
578
|
})(GuildInviteFlags || (exports.GuildInviteFlags = GuildInviteFlags = {}));
|
|
579
|
+
/** https://discord.com/developers/docs/resources/lobby#lobby-member-object-lobby-member-flags */
|
|
580
|
+
var LobbyMemberFlags;
|
|
581
|
+
(function (LobbyMemberFlags) {
|
|
582
|
+
LobbyMemberFlags[LobbyMemberFlags["CanLinkLobby"] = 1] = "CanLinkLobby";
|
|
583
|
+
})(LobbyMemberFlags || (exports.LobbyMemberFlags = LobbyMemberFlags = {}));
|
|
579
584
|
/** https://discord.com/developers/docs/resources/message#message-object-message-types */
|
|
580
585
|
var MessageTypes;
|
|
581
586
|
(function (MessageTypes) {
|
|
@@ -1264,6 +1269,7 @@ var JSONErrorCodes;
|
|
|
1264
1269
|
JSONErrorCodes[JSONErrorCodes["MessageBlockedByHarmfulLinksFilter"] = 240000] = "MessageBlockedByHarmfulLinksFilter";
|
|
1265
1270
|
JSONErrorCodes[JSONErrorCodes["CannotEnableOnboardingRequirementsAreNotMet"] = 350000] = "CannotEnableOnboardingRequirementsAreNotMet";
|
|
1266
1271
|
JSONErrorCodes[JSONErrorCodes["CannotUpdateOnboardingWhileBelowRequirements"] = 350001] = "CannotUpdateOnboardingWhileBelowRequirements";
|
|
1272
|
+
JSONErrorCodes[JSONErrorCodes["AccessToFileUploadsHasBeenLimitedForThisGuild"] = 400001] = "AccessToFileUploadsHasBeenLimitedForThisGuild";
|
|
1267
1273
|
JSONErrorCodes[JSONErrorCodes["FailedToBanUsers"] = 500000] = "FailedToBanUsers";
|
|
1268
1274
|
JSONErrorCodes[JSONErrorCodes["PollVotingBlocked"] = 520000] = "PollVotingBlocked";
|
|
1269
1275
|
JSONErrorCodes[JSONErrorCodes["PollExpired"] = 520001] = "PollExpired";
|
|
@@ -108,3 +108,7 @@ export declare const stageInstance: (channelID: snowflake) => `stage-instances/$
|
|
|
108
108
|
export declare const stageInstances: () => "stage-instances";
|
|
109
109
|
export declare const sticker: (stickerID: snowflake) => `stickers/${string}`;
|
|
110
110
|
export declare const voiceRegions: () => "voice/regions";
|
|
111
|
+
export declare const lobbies: () => "lobbies";
|
|
112
|
+
export declare const lobby: (lobbyID: snowflake) => `lobbies/${string}`;
|
|
113
|
+
export declare const lobbyMember: (lobbyID: snowflake, userID?: snowflake | "@me") => `lobbies/${string}/members/${string}`;
|
|
114
|
+
export declare const lobbyChannelLinking: (lobbyID: snowflake) => `lobbies/${string}/channel-linking`;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.channelInvites = exports.channelFollowers = exports.channelBulkDelete = exports.channel = exports.template = exports.guildWidgetSettings = exports.guildWidgetJSON = exports.guildWidgetImage = exports.guildWelcomeScreen = exports.guildWebhooks = exports.guildVoiceState = exports.guildVoiceRegions = exports.guildVanityURL = exports.guildTemplates = exports.guildTemplate = exports.guildStickers = exports.guildSticker = exports.guildSoundboardSounds = exports.guildSoundboardSound = exports.guildScheduledEventUsers = exports.guildScheduledEvents = exports.guildScheduledEvent = exports.guildRoles = exports.guildRole = exports.guildPrune = exports.guildPreview = exports.guildOnboarding = exports.guildMemberVerification = exports.guildMembersSearch = exports.guildMembers = exports.guildMemberRole = exports.guildMember = exports.guildMFA = exports.guildInvites = exports.guildIntegrations = exports.guildIntegration = exports.guildIncidentsActions = exports.guildEmojis = exports.guildEmoji = exports.guildMemberNickname = exports.guildChannels = exports.guildBulkBan = exports.guildBans = exports.guildBan = exports.guildAutoModerationRules = exports.guildAutoModerationRule = exports.guildAuditLog = exports.guildActiveThreads = exports.guilds = exports.guild = void 0;
|
|
4
4
|
exports.oauth2Application = exports.oauth2Authorize = exports.gatewayBot = exports.gateway = exports.soundboardDefaultSounds = exports.sendSoundboardSound = exports.skuSubscriptions = exports.skuSubscription = exports.stickerPacks = exports.stickerPack = exports.webhookPlatform = exports.webhookMessage = exports.webhook = exports.guildApplicationCommandsPermissions = exports.applicationSKUs = exports.applicationRoleConnectionMetadata = exports.applicationGuildCommands = exports.applicationGuildCommand = exports.applicationEntitlements = exports.applicationEntitlementConsume = exports.applicationEntitlement = exports.applicationEmojis = exports.applicationEmoji = exports.applicationUser = exports.applicationCommandPermissions = exports.applicationCommands = exports.applicationCommand = exports.applicationActivityInstance = exports.userGuilds = exports.userGuild = exports.userConnections = exports.userChannels = exports.userApplicationRoleConnection = exports.user = exports.pollExpire = exports.pollAnswerVoters = exports.threadMembers = exports.threads = exports.channelWebhooks = exports.channelTyping = exports.channelThreads = exports.channelRecipient = exports.channelPins = exports.channelPin = exports.channelPermission = exports.channelMessages = exports.channelMessageReaction = exports.channelMessageCrosspost = exports.channelMessageAllReactions = exports.channelMessage = void 0;
|
|
5
|
-
exports.voiceRegions = exports.sticker = exports.stageInstances = exports.stageInstance = exports.invite = exports.interactionCallback = exports.oauth2TokenRevocation = exports.oauth2TokenExchange = exports.oauth2Authorization = void 0;
|
|
5
|
+
exports.lobbyChannelLinking = exports.lobbyMember = exports.lobby = exports.lobbies = exports.voiceRegions = exports.sticker = exports.stageInstances = exports.stageInstance = exports.invite = exports.interactionCallback = exports.oauth2TokenRevocation = exports.oauth2TokenExchange = exports.oauth2Authorization = void 0;
|
|
6
6
|
// Guilds
|
|
7
7
|
const guild = (guildID) => `guilds/${guildID}`;
|
|
8
8
|
exports.guild = guild;
|
|
@@ -242,3 +242,12 @@ const sticker = (stickerID) => `stickers/${stickerID}`;
|
|
|
242
242
|
exports.sticker = sticker;
|
|
243
243
|
const voiceRegions = () => "voice/regions";
|
|
244
244
|
exports.voiceRegions = voiceRegions;
|
|
245
|
+
// Lobbies
|
|
246
|
+
const lobbies = () => "lobbies";
|
|
247
|
+
exports.lobbies = lobbies;
|
|
248
|
+
const lobby = (lobbyID) => `lobbies/${lobbyID}`;
|
|
249
|
+
exports.lobby = lobby;
|
|
250
|
+
const lobbyMember = (lobbyID, userID = "@me") => `lobbies/${lobbyID}/members/${userID}`;
|
|
251
|
+
exports.lobbyMember = lobbyMember;
|
|
252
|
+
const lobbyChannelLinking = (lobbyID) => `lobbies/${lobbyID}/channel-linking`;
|
|
253
|
+
exports.lobbyChannelLinking = lobbyChannelLinking;
|
|
@@ -20,10 +20,10 @@ export declare class Components {
|
|
|
20
20
|
static roleSelectToRaw(roleSelect: RoleSelect): RawRoleSelect;
|
|
21
21
|
static sectionFromRaw(section: RawSection): Section;
|
|
22
22
|
static sectionToRaw(section: Section): RawSection;
|
|
23
|
-
static stringSelectFromRaw(stringSelect: RawStringSelect): StringSelect;
|
|
24
|
-
static stringSelectToRaw(stringSelect: StringSelect): RawStringSelect;
|
|
25
23
|
static separatorFromRaw(separator: RawSeparator): Separator;
|
|
26
24
|
static separatorToRaw(separator: Separator): RawSeparator;
|
|
25
|
+
static stringSelectFromRaw(stringSelect: RawStringSelect): StringSelect;
|
|
26
|
+
static stringSelectToRaw(stringSelect: StringSelect): RawStringSelect;
|
|
27
27
|
static textDisplayFromRaw(textDisplay: RawTextDisplay): TextDisplay;
|
|
28
28
|
static textDisplayToRaw(textDisplay: TextDisplay): RawTextDisplay;
|
|
29
29
|
static textInputFromRaw(textInput: RawTextInput): TextInput;
|
|
@@ -186,11 +186,23 @@ class Components {
|
|
|
186
186
|
static labelFromRaw(label) {
|
|
187
187
|
let component;
|
|
188
188
|
switch (label.component.type) {
|
|
189
|
+
case constants_js_1.ComponentTypes.TextInput:
|
|
190
|
+
component = Components.textInputFromRaw(label.component);
|
|
191
|
+
break;
|
|
189
192
|
case constants_js_1.ComponentTypes.StringSelect:
|
|
190
193
|
component = Components.stringSelectFromRaw(label.component);
|
|
191
194
|
break;
|
|
192
|
-
case constants_js_1.ComponentTypes.
|
|
193
|
-
component = Components.
|
|
195
|
+
case constants_js_1.ComponentTypes.UserSelect:
|
|
196
|
+
component = Components.userSelectFromRaw(label.component);
|
|
197
|
+
break;
|
|
198
|
+
case constants_js_1.ComponentTypes.RoleSelect:
|
|
199
|
+
component = Components.roleSelectFromRaw(label.component);
|
|
200
|
+
break;
|
|
201
|
+
case constants_js_1.ComponentTypes.MentionableSelect:
|
|
202
|
+
component = Components.mentionableSelectFromRaw(label.component);
|
|
203
|
+
break;
|
|
204
|
+
case constants_js_1.ComponentTypes.ChannelSelect:
|
|
205
|
+
component = Components.channelSelectFromRaw(label.component);
|
|
194
206
|
break;
|
|
195
207
|
}
|
|
196
208
|
return {
|
|
@@ -204,11 +216,23 @@ class Components {
|
|
|
204
216
|
static labelToRaw(label) {
|
|
205
217
|
let component;
|
|
206
218
|
switch (label.component.type) {
|
|
219
|
+
case constants_js_1.ComponentTypes.TextInput:
|
|
220
|
+
component = Components.textInputToRaw(label.component);
|
|
221
|
+
break;
|
|
207
222
|
case constants_js_1.ComponentTypes.StringSelect:
|
|
208
223
|
component = Components.stringSelectToRaw(label.component);
|
|
209
224
|
break;
|
|
210
|
-
case constants_js_1.ComponentTypes.
|
|
211
|
-
component = Components.
|
|
225
|
+
case constants_js_1.ComponentTypes.UserSelect:
|
|
226
|
+
component = Components.userSelectToRaw(label.component);
|
|
227
|
+
break;
|
|
228
|
+
case constants_js_1.ComponentTypes.RoleSelect:
|
|
229
|
+
component = Components.roleSelectToRaw(label.component);
|
|
230
|
+
break;
|
|
231
|
+
case constants_js_1.ComponentTypes.MentionableSelect:
|
|
232
|
+
component = Components.mentionableSelectToRaw(label.component);
|
|
233
|
+
break;
|
|
234
|
+
case constants_js_1.ComponentTypes.ChannelSelect:
|
|
235
|
+
component = Components.channelSelectToRaw(label.component);
|
|
212
236
|
break;
|
|
213
237
|
}
|
|
214
238
|
return {
|
|
@@ -290,23 +314,63 @@ class Components {
|
|
|
290
314
|
};
|
|
291
315
|
}
|
|
292
316
|
static sectionFromRaw(section) {
|
|
317
|
+
let accessory;
|
|
318
|
+
switch (section.accessory.type) {
|
|
319
|
+
case constants_js_1.ComponentTypes.Button:
|
|
320
|
+
accessory = Components.buttonFromRaw(section.accessory);
|
|
321
|
+
break;
|
|
322
|
+
case constants_js_1.ComponentTypes.Thumbnail:
|
|
323
|
+
accessory = Components.thumbnailFromRaw(section.accessory);
|
|
324
|
+
break;
|
|
325
|
+
}
|
|
293
326
|
return {
|
|
294
327
|
type: section.type,
|
|
295
328
|
id: section.id,
|
|
296
|
-
components:
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
329
|
+
components: section.components.map((component) => {
|
|
330
|
+
switch (component.type) {
|
|
331
|
+
case constants_js_1.ComponentTypes.TextDisplay:
|
|
332
|
+
return Components.textDisplayFromRaw(component);
|
|
333
|
+
}
|
|
334
|
+
}),
|
|
335
|
+
accessory,
|
|
300
336
|
};
|
|
301
337
|
}
|
|
302
338
|
static sectionToRaw(section) {
|
|
339
|
+
let accessory;
|
|
340
|
+
switch (section.accessory.type) {
|
|
341
|
+
case constants_js_1.ComponentTypes.Button:
|
|
342
|
+
accessory = Components.buttonToRaw(section.accessory);
|
|
343
|
+
break;
|
|
344
|
+
case constants_js_1.ComponentTypes.Thumbnail:
|
|
345
|
+
accessory = Components.thumbnailToRaw(section.accessory);
|
|
346
|
+
break;
|
|
347
|
+
}
|
|
303
348
|
return {
|
|
304
349
|
type: section.type,
|
|
305
350
|
id: section.id,
|
|
306
|
-
components:
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
351
|
+
components: section.components.map((component) => {
|
|
352
|
+
switch (component.type) {
|
|
353
|
+
case constants_js_1.ComponentTypes.TextDisplay:
|
|
354
|
+
return Components.textDisplayToRaw(component);
|
|
355
|
+
}
|
|
356
|
+
}),
|
|
357
|
+
accessory,
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
static separatorFromRaw(separator) {
|
|
361
|
+
return {
|
|
362
|
+
type: separator.type,
|
|
363
|
+
id: separator.id,
|
|
364
|
+
divider: separator.divider,
|
|
365
|
+
spacing: separator.spacing,
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
static separatorToRaw(separator) {
|
|
369
|
+
return {
|
|
370
|
+
type: separator.type,
|
|
371
|
+
id: separator.id,
|
|
372
|
+
divider: separator.divider,
|
|
373
|
+
spacing: separator.spacing,
|
|
310
374
|
};
|
|
311
375
|
}
|
|
312
376
|
static stringSelectFromRaw(stringSelect) {
|
|
@@ -356,22 +420,6 @@ class Components {
|
|
|
356
420
|
disabled: stringSelect.disabled,
|
|
357
421
|
};
|
|
358
422
|
}
|
|
359
|
-
static separatorFromRaw(separator) {
|
|
360
|
-
return {
|
|
361
|
-
type: separator.type,
|
|
362
|
-
id: separator.id,
|
|
363
|
-
divider: separator.divider,
|
|
364
|
-
spacing: separator.spacing,
|
|
365
|
-
};
|
|
366
|
-
}
|
|
367
|
-
static separatorToRaw(separator) {
|
|
368
|
-
return {
|
|
369
|
-
type: separator.type,
|
|
370
|
-
id: separator.id,
|
|
371
|
-
divider: separator.divider,
|
|
372
|
-
spacing: separator.spacing,
|
|
373
|
-
};
|
|
374
|
-
}
|
|
375
423
|
static textDisplayFromRaw(textDisplay) {
|
|
376
424
|
return {
|
|
377
425
|
type: textDisplay.type,
|
|
@@ -397,6 +445,7 @@ class Components {
|
|
|
397
445
|
value: textInput.value,
|
|
398
446
|
placeholder: textInput.placeholder,
|
|
399
447
|
id: textInput.id,
|
|
448
|
+
label: textInput.label,
|
|
400
449
|
};
|
|
401
450
|
}
|
|
402
451
|
static textInputToRaw(textInput) {
|
|
@@ -410,6 +459,7 @@ class Components {
|
|
|
410
459
|
value: textInput.value,
|
|
411
460
|
placeholder: textInput.placeholder,
|
|
412
461
|
id: textInput.id,
|
|
462
|
+
label: textInput.label,
|
|
413
463
|
};
|
|
414
464
|
}
|
|
415
465
|
static thumbnailFromRaw(thumbnail) {
|