disgroove 2.2.6 → 2.2.7-dev.19963da
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 +46 -52
- package/dist/lib/Client.js +88 -59
- package/dist/lib/constants.d.ts +33 -22
- package/dist/lib/constants.js +36 -24
- package/dist/lib/gateway/Shard.js +14 -0
- package/dist/lib/rest/Endpoints.d.ts +4 -0
- package/dist/lib/rest/Endpoints.js +10 -1
- package/dist/lib/rest/RequestManager.d.ts +1 -3
- package/dist/lib/transformers/Components.d.ts +13 -3
- package/dist/lib/transformers/Components.js +238 -135
- package/dist/lib/transformers/Interactions.js +130 -38
- package/dist/lib/transformers/Lobbies.d.ts +7 -0
- package/dist/lib/transformers/Lobbies.js +38 -0
- package/dist/lib/transformers/Messages.d.ts +4 -3
- package/dist/lib/transformers/Messages.js +20 -34
- 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 +20 -0
- package/dist/lib/types/guild.d.ts +7 -5
- package/dist/lib/types/interaction.d.ts +14 -8
- package/dist/lib/types/invite.d.ts +2 -2
- 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 +306 -118
- package/dist/lib/types/message.d.ts +2 -4
- package/dist/package.json +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Lobbies = void 0;
|
|
4
|
+
class Lobbies {
|
|
5
|
+
static lobbyFromRaw(lobby) {
|
|
6
|
+
return {
|
|
7
|
+
id: lobby.id,
|
|
8
|
+
applicationID: lobby.application_id,
|
|
9
|
+
metadata: lobby.metadata,
|
|
10
|
+
members: lobby.members,
|
|
11
|
+
linkedChannel: lobby.linked_channel,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
static lobbyMemberFromRaw(lobbyMember) {
|
|
15
|
+
return {
|
|
16
|
+
id: lobbyMember.id,
|
|
17
|
+
metadata: lobbyMember.metadata,
|
|
18
|
+
flags: lobbyMember.flags,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
static lobbyMemberToRaw(lobbyMember) {
|
|
22
|
+
return {
|
|
23
|
+
id: lobbyMember.id,
|
|
24
|
+
metadata: lobbyMember.metadata,
|
|
25
|
+
flags: lobbyMember.flags,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
static lobbyToRaw(lobby) {
|
|
29
|
+
return {
|
|
30
|
+
id: lobby.id,
|
|
31
|
+
application_id: lobby.applicationID,
|
|
32
|
+
metadata: lobby.metadata,
|
|
33
|
+
members: lobby.members,
|
|
34
|
+
linked_channel: lobby.linkedChannel,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.Lobbies = Lobbies;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { RawAttachment, Attachment, RawEmbed, Embed, RawMessage, Message
|
|
1
|
+
import { RawAttachment, Attachment, RawEmbed, Embed, RawMessage, Message } from "../types/message";
|
|
2
|
+
import type { ActionRow, Container, File, MediaGallery, RawActionRow, RawContainer, RawFile, RawMediaGallery, RawSection, RawSeparator, RawTextDisplay, Section, Separator, TextDisplay } from "../types/message-components";
|
|
2
3
|
export declare class Messages {
|
|
3
4
|
static attachmentFromRaw(attachment: RawAttachment): Attachment;
|
|
4
5
|
static attachmentToRaw(attachment: Attachment): RawAttachment;
|
|
5
|
-
static componentsFromRaw(components: Array<
|
|
6
|
-
static componentsToRaw(components: Array<
|
|
6
|
+
static componentsFromRaw(components: Array<RawActionRow | RawSection | RawTextDisplay | RawMediaGallery | RawFile | RawSeparator | RawContainer>): Array<ActionRow | Section | TextDisplay | MediaGallery | File | Separator | Container>;
|
|
7
|
+
static componentsToRaw(components: Array<ActionRow | Section | TextDisplay | MediaGallery | File | Separator | Container>): Array<RawActionRow | RawSection | RawTextDisplay | RawMediaGallery | RawFile | RawSeparator | RawContainer>;
|
|
7
8
|
static embedFromRaw(embed: RawEmbed): Embed;
|
|
8
9
|
static embedToRaw(embed: Embed): RawEmbed;
|
|
9
10
|
static messageFromRaw(message: RawMessage): Message;
|
|
@@ -51,54 +51,40 @@ class Messages {
|
|
|
51
51
|
static componentsFromRaw(components) {
|
|
52
52
|
return components.map((component) => {
|
|
53
53
|
switch (component.type) {
|
|
54
|
-
case constants_1.ComponentTypes.ActionRow:
|
|
54
|
+
case constants_1.ComponentTypes.ActionRow:
|
|
55
55
|
return Components_js_1.Components.actionRowFromRaw(component);
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
case constants_1.ComponentTypes.Section:
|
|
57
|
+
return Components_js_1.Components.sectionFromRaw(component);
|
|
58
|
+
case constants_1.ComponentTypes.TextDisplay:
|
|
58
59
|
return Components_js_1.Components.textDisplayFromRaw(component);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
case constants_1.ComponentTypes.File: {
|
|
60
|
+
case constants_1.ComponentTypes.MediaGallery:
|
|
61
|
+
return Components_js_1.Components.mediaGalleryFromRaw(component);
|
|
62
|
+
case constants_1.ComponentTypes.File:
|
|
64
63
|
return Components_js_1.Components.fileFromRaw(component);
|
|
65
|
-
|
|
66
|
-
case constants_1.ComponentTypes.Section: {
|
|
67
|
-
return Components_js_1.Components.sectionFromRaw(component);
|
|
68
|
-
}
|
|
69
|
-
case constants_1.ComponentTypes.Separator: {
|
|
64
|
+
case constants_1.ComponentTypes.Separator:
|
|
70
65
|
return Components_js_1.Components.separatorFromRaw(component);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return Components_js_1.Components.mediaGalleryFromRaw(component);
|
|
74
|
-
}
|
|
66
|
+
case constants_1.ComponentTypes.Container:
|
|
67
|
+
return Components_js_1.Components.containerFromRaw(component);
|
|
75
68
|
}
|
|
76
69
|
});
|
|
77
70
|
}
|
|
78
71
|
static componentsToRaw(components) {
|
|
79
72
|
return components.map((component) => {
|
|
80
73
|
switch (component.type) {
|
|
81
|
-
case constants_1.ComponentTypes.ActionRow:
|
|
74
|
+
case constants_1.ComponentTypes.ActionRow:
|
|
82
75
|
return Components_js_1.Components.actionRowToRaw(component);
|
|
83
|
-
|
|
84
|
-
|
|
76
|
+
case constants_1.ComponentTypes.Section:
|
|
77
|
+
return Components_js_1.Components.sectionToRaw(component);
|
|
78
|
+
case constants_1.ComponentTypes.TextDisplay:
|
|
85
79
|
return Components_js_1.Components.textDisplayToRaw(component);
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
case constants_1.ComponentTypes.File: {
|
|
80
|
+
case constants_1.ComponentTypes.MediaGallery:
|
|
81
|
+
return Components_js_1.Components.mediaGalleryToRaw(component);
|
|
82
|
+
case constants_1.ComponentTypes.File:
|
|
91
83
|
return Components_js_1.Components.fileToRaw(component);
|
|
92
|
-
|
|
93
|
-
case constants_1.ComponentTypes.Section: {
|
|
94
|
-
return Components_js_1.Components.sectionToRaw(component);
|
|
95
|
-
}
|
|
96
|
-
case constants_1.ComponentTypes.Separator: {
|
|
84
|
+
case constants_1.ComponentTypes.Separator:
|
|
97
85
|
return Components_js_1.Components.separatorToRaw(component);
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return Components_js_1.Components.mediaGalleryToRaw(component);
|
|
101
|
-
}
|
|
86
|
+
case constants_1.ComponentTypes.Container:
|
|
87
|
+
return Components_js_1.Components.containerToRaw(component);
|
|
102
88
|
}
|
|
103
89
|
});
|
|
104
90
|
}
|
|
@@ -4,7 +4,7 @@ export * from "./Applications";
|
|
|
4
4
|
export * from "./AuditLogs";
|
|
5
5
|
export * from "./AutoModeration";
|
|
6
6
|
export * from "./Channels";
|
|
7
|
-
export * from "./Components
|
|
7
|
+
export * from "./Components";
|
|
8
8
|
export * from "./Emojis";
|
|
9
9
|
export * from "./Entitlements";
|
|
10
10
|
export * from "./Guilds";
|
|
@@ -12,6 +12,7 @@ export * from "./GuildScheduledEvents";
|
|
|
12
12
|
export * from "./GuildTemplates";
|
|
13
13
|
export * from "./Interactions";
|
|
14
14
|
export * from "./Invites";
|
|
15
|
+
export * from "./Lobbies";
|
|
15
16
|
export * from "./Messages";
|
|
16
17
|
export * from "./Polls";
|
|
17
18
|
export * from "./Presences";
|
|
@@ -20,7 +20,7 @@ __exportStar(require("./Applications"), exports);
|
|
|
20
20
|
__exportStar(require("./AuditLogs"), exports);
|
|
21
21
|
__exportStar(require("./AutoModeration"), exports);
|
|
22
22
|
__exportStar(require("./Channels"), exports);
|
|
23
|
-
__exportStar(require("./Components
|
|
23
|
+
__exportStar(require("./Components"), exports);
|
|
24
24
|
__exportStar(require("./Emojis"), exports);
|
|
25
25
|
__exportStar(require("./Entitlements"), exports);
|
|
26
26
|
__exportStar(require("./Guilds"), exports);
|
|
@@ -28,6 +28,7 @@ __exportStar(require("./GuildScheduledEvents"), exports);
|
|
|
28
28
|
__exportStar(require("./GuildTemplates"), exports);
|
|
29
29
|
__exportStar(require("./Interactions"), exports);
|
|
30
30
|
__exportStar(require("./Invites"), exports);
|
|
31
|
+
__exportStar(require("./Lobbies"), exports);
|
|
31
32
|
__exportStar(require("./Messages"), exports);
|
|
32
33
|
__exportStar(require("./Polls"), exports);
|
|
33
34
|
__exportStar(require("./Presences"), exports);
|
|
@@ -375,6 +375,17 @@ export interface RawMessagePollVoteRemoveFields {
|
|
|
375
375
|
guild_id?: snowflake;
|
|
376
376
|
answer_id: number;
|
|
377
377
|
}
|
|
378
|
+
/** https://discord.com/developers/docs/events/gateway-events#rate-limited-rate-limited-fields */
|
|
379
|
+
export interface RawRateLimitedFields {
|
|
380
|
+
opcode: GatewayOPCodes;
|
|
381
|
+
retry_after: number;
|
|
382
|
+
meta: RawRequestGuildMembersRateLimitMetadata;
|
|
383
|
+
}
|
|
384
|
+
/** https://discord.com/developers/docs/events/gateway-events#rate-limited-rate-limit-metadata-for-opcode-structure */
|
|
385
|
+
export interface RawRequestGuildMembersRateLimitMetadata {
|
|
386
|
+
guild_id: snowflake;
|
|
387
|
+
nonce?: string;
|
|
388
|
+
}
|
|
378
389
|
export interface Payload {
|
|
379
390
|
op: GatewayOPCodes;
|
|
380
391
|
d: any | null;
|
|
@@ -691,3 +702,12 @@ export interface MessagePollVoteRemoveFields {
|
|
|
691
702
|
guildID?: snowflake;
|
|
692
703
|
answerID: number;
|
|
693
704
|
}
|
|
705
|
+
export interface RateLimitedFields {
|
|
706
|
+
opcode: GatewayOPCodes;
|
|
707
|
+
retryAfter: number;
|
|
708
|
+
meta: RequestGuildMembersRateLimitMetadata;
|
|
709
|
+
}
|
|
710
|
+
export interface RequestGuildMembersRateLimitMetadata {
|
|
711
|
+
guildID: snowflake;
|
|
712
|
+
nonce?: string;
|
|
713
|
+
}
|
|
@@ -93,13 +93,14 @@ export interface RawGuildMember {
|
|
|
93
93
|
banner?: string | null;
|
|
94
94
|
roles: Array<snowflake>;
|
|
95
95
|
joined_at: timestamp | null;
|
|
96
|
-
premium_since?:
|
|
96
|
+
premium_since?: timestamp | null;
|
|
97
97
|
deaf: boolean;
|
|
98
98
|
mute: boolean;
|
|
99
99
|
flags: GuildMemberFlags;
|
|
100
100
|
pending?: boolean;
|
|
101
101
|
permissions?: string;
|
|
102
|
-
communication_disabled_until?:
|
|
102
|
+
communication_disabled_until?: timestamp | null;
|
|
103
|
+
unusual_dm_activity_until?: timestamp | null;
|
|
103
104
|
avatar_decoration_data?: RawAvatarDecorationData | null;
|
|
104
105
|
}
|
|
105
106
|
/** https://discord.com/developers/docs/resources/guild#integration-object-integration-structure */
|
|
@@ -269,14 +270,15 @@ export interface GuildMember {
|
|
|
269
270
|
avatar?: string | null;
|
|
270
271
|
banner?: string | null;
|
|
271
272
|
roles: Array<snowflake>;
|
|
272
|
-
joinedAt:
|
|
273
|
-
premiumSince?:
|
|
273
|
+
joinedAt: timestamp | null;
|
|
274
|
+
premiumSince?: timestamp | null;
|
|
274
275
|
deaf: boolean;
|
|
275
276
|
mute: boolean;
|
|
276
277
|
flags: GuildMemberFlags;
|
|
277
278
|
pending?: boolean;
|
|
278
279
|
permissions?: string;
|
|
279
|
-
communicationDisabledUntil?:
|
|
280
|
+
communicationDisabledUntil?: timestamp | null;
|
|
281
|
+
unusualDMActivityUntil?: timestamp | null;
|
|
280
282
|
avatarDecorationData?: AvatarDecorationData | null;
|
|
281
283
|
}
|
|
282
284
|
export interface Integration {
|
|
@@ -5,8 +5,8 @@ import type { RawChannel, Channel } from "./channel";
|
|
|
5
5
|
import type { snowflake } from "./common";
|
|
6
6
|
import type { RawEntitlement, Entitlement } from "./entitlements";
|
|
7
7
|
import type { RawGuildMember, GuildMember, Guild, RawGuild } from "./guild";
|
|
8
|
-
import type { RawMessage, RawAttachment, RawEmbed, RawAllowedMentions, Message, Attachment, Embed, AllowedMentions
|
|
9
|
-
import type {
|
|
8
|
+
import type { RawMessage, RawAttachment, RawEmbed, RawAllowedMentions, Message, Attachment, Embed, AllowedMentions } from "./message";
|
|
9
|
+
import type { ActionRow, Container, File, Label, MediaGallery, RawActionRow, RawContainer, RawFile, RawLabel, RawMediaGallery, RawSection, RawSeparator, RawStringSelectInteractionResponse, RawTextDisplay, RawTextInputInteractionResponse, Section, Separator, StringSelectInteractionResponse, TextDisplay, TextInputInteractionResponse } from "./message-components";
|
|
10
10
|
import type { RawPollCreateParams, PollCreateParams } from "./poll";
|
|
11
11
|
import type { RawRole, Role } from "./role";
|
|
12
12
|
import type { RawUser, User } from "./user";
|
|
@@ -33,6 +33,7 @@ export interface RawInteraction {
|
|
|
33
33
|
entitlements: Array<RawEntitlement>;
|
|
34
34
|
authorizing_integration_owners: Record<ApplicationIntegrationTypes, string>;
|
|
35
35
|
context?: InteractionContextTypes;
|
|
36
|
+
attachment_size_limit: number;
|
|
36
37
|
}
|
|
37
38
|
/** https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-application-command-data-structure */
|
|
38
39
|
export interface RawApplicationCommandData {
|
|
@@ -56,8 +57,10 @@ export interface RawModalSubmitData {
|
|
|
56
57
|
custom_id: string;
|
|
57
58
|
components: Array<{
|
|
58
59
|
type: ComponentTypes.ActionRow;
|
|
59
|
-
components: Array<
|
|
60
|
-
}
|
|
60
|
+
components: Array<RawStringSelectInteractionResponse | RawTextInputInteractionResponse>;
|
|
61
|
+
} | RawTextDisplay | (Omit<RawLabel, "component"> & {
|
|
62
|
+
component: RawStringSelectInteractionResponse | RawTextInputInteractionResponse;
|
|
63
|
+
})>;
|
|
61
64
|
}
|
|
62
65
|
/** https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure */
|
|
63
66
|
export interface RawResolvedData {
|
|
@@ -96,7 +99,7 @@ export interface RawInteractionCallbackData {
|
|
|
96
99
|
embeds?: Array<RawEmbed>;
|
|
97
100
|
allowed_mentions?: RawAllowedMentions;
|
|
98
101
|
flags?: MessageFlags;
|
|
99
|
-
components?: Array<
|
|
102
|
+
components?: Array<RawActionRow | RawSection | RawTextDisplay | RawMediaGallery | RawFile | RawSeparator | RawContainer | RawLabel>;
|
|
100
103
|
attachments?: Array<Pick<RawAttachment, "filename" | "description">>;
|
|
101
104
|
poll?: RawPollCreateParams;
|
|
102
105
|
files?: Array<FileData>;
|
|
@@ -150,6 +153,7 @@ export interface Interaction {
|
|
|
150
153
|
entitlements: Array<Entitlement>;
|
|
151
154
|
authorizingIntegrationOwners: Record<ApplicationIntegrationTypes, string>;
|
|
152
155
|
context?: InteractionContextTypes;
|
|
156
|
+
attachmentSizeLimit: number;
|
|
153
157
|
}
|
|
154
158
|
export interface ApplicationCommandData {
|
|
155
159
|
id: snowflake;
|
|
@@ -170,8 +174,10 @@ export interface ModalSubmitData {
|
|
|
170
174
|
customID: string;
|
|
171
175
|
components: Array<{
|
|
172
176
|
type: ComponentTypes.ActionRow;
|
|
173
|
-
components: Array<
|
|
174
|
-
}
|
|
177
|
+
components: Array<StringSelectInteractionResponse | TextInputInteractionResponse>;
|
|
178
|
+
} | TextDisplay | (Omit<Label, "component"> & {
|
|
179
|
+
component: StringSelectInteractionResponse | TextInputInteractionResponse;
|
|
180
|
+
})>;
|
|
175
181
|
}
|
|
176
182
|
export interface ResolvedData {
|
|
177
183
|
users?: Record<snowflake, User>;
|
|
@@ -205,7 +211,7 @@ export interface InteractionCallbackData {
|
|
|
205
211
|
embeds?: Array<Embed>;
|
|
206
212
|
allowedMentions?: AllowedMentions;
|
|
207
213
|
flags?: MessageFlags;
|
|
208
|
-
components?: Array<
|
|
214
|
+
components?: Array<ActionRow | Section | TextDisplay | MediaGallery | File | Separator | Container | Label>;
|
|
209
215
|
attachments?: Array<Pick<Attachment, "filename" | "description">>;
|
|
210
216
|
poll?: PollCreateParams;
|
|
211
217
|
files?: Array<FileData>;
|
|
@@ -17,7 +17,7 @@ export interface RawInvite {
|
|
|
17
17
|
target_application?: RawApplication;
|
|
18
18
|
approximate_presence_count?: number;
|
|
19
19
|
approximate_member_count?: number;
|
|
20
|
-
expires_at
|
|
20
|
+
expires_at: timestamp | null;
|
|
21
21
|
stage_instance?: RawInviteStageInstance;
|
|
22
22
|
guild_scheduled_event?: RawGuildScheduledEvent;
|
|
23
23
|
flags?: GuildInviteFlags;
|
|
@@ -48,7 +48,7 @@ export interface Invite {
|
|
|
48
48
|
targetApplication?: Application;
|
|
49
49
|
approximatePresenceCount?: number;
|
|
50
50
|
approximateMemberCount?: number;
|
|
51
|
-
expiresAt
|
|
51
|
+
expiresAt: timestamp | null;
|
|
52
52
|
stageInstance?: InviteStageInstance;
|
|
53
53
|
guildScheduledEvent?: GuildScheduledEvent;
|
|
54
54
|
flags?: GuildInviteFlags;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { LobbyMemberFlags } from "../constants";
|
|
2
|
+
import type { RawChannel } from "./channel";
|
|
3
|
+
import type { snowflake } from "./common";
|
|
4
|
+
/** https://discord.com/developers/docs/resources/lobby#lobby-object */
|
|
5
|
+
export interface RawLobby {
|
|
6
|
+
id: snowflake;
|
|
7
|
+
application_id: snowflake;
|
|
8
|
+
metadata: Record<string, string> | null;
|
|
9
|
+
members: Array<RawLobbyMember>;
|
|
10
|
+
linked_channel: RawChannel;
|
|
11
|
+
}
|
|
12
|
+
/** https://discord.com/developers/docs/resources/lobby#lobby-member-object-lobby-member-structure */
|
|
13
|
+
export interface RawLobbyMember {
|
|
14
|
+
id: snowflake;
|
|
15
|
+
metadata?: Record<string, string> | null;
|
|
16
|
+
flags?: LobbyMemberFlags;
|
|
17
|
+
}
|
|
18
|
+
export interface Lobby {
|
|
19
|
+
id: snowflake;
|
|
20
|
+
applicationID: snowflake;
|
|
21
|
+
metadata: Record<string, string> | null;
|
|
22
|
+
members: Array<LobbyMember>;
|
|
23
|
+
linkedChannel: RawChannel;
|
|
24
|
+
}
|
|
25
|
+
export interface LobbyMember {
|
|
26
|
+
id: snowflake;
|
|
27
|
+
metadata?: Record<string, string> | null;
|
|
28
|
+
flags?: LobbyMemberFlags;
|
|
29
|
+
}
|