disgroove 3.0.1-dev.c1d6d42 → 3.0.2
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/LICENSE +1 -1
- package/dist/lib/Client.d.ts +53 -11
- package/dist/lib/Client.js +79 -23
- package/dist/lib/constants.d.ts +21 -9
- package/dist/lib/constants.js +21 -8
- package/dist/lib/gateway/Dispatcher.js +1 -0
- package/dist/lib/gateway/Shard.js +1 -0
- package/dist/lib/gateway/Transmitter.js +2 -1
- package/dist/lib/rest/Endpoints.d.ts +5 -1
- package/dist/lib/rest/Endpoints.js +9 -1
- package/dist/lib/rest/RequestManager.d.ts +1 -0
- package/dist/lib/rest/RequestManager.js +2 -3
- package/dist/lib/transformers/ApplicationCommands.js +2 -0
- package/dist/lib/transformers/Applications.js +2 -0
- package/dist/lib/transformers/Channels.d.ts +3 -0
- package/dist/lib/transformers/Channels.js +24 -0
- package/dist/lib/transformers/Components.js +2 -0
- package/dist/lib/transformers/Lobbies.d.ts +3 -1
- package/dist/lib/transformers/Lobbies.js +31 -0
- package/dist/lib/types/application-command.d.ts +2 -0
- package/dist/lib/types/application.d.ts +2 -0
- package/dist/lib/types/channel.d.ts +4 -2
- package/dist/lib/types/components.d.ts +4 -2
- package/dist/lib/types/gateway-events.d.ts +9 -3
- package/dist/lib/types/lobby.d.ts +38 -1
- package/dist/lib/types/message.d.ts +20 -0
- package/dist/lib/utils/formatters.d.ts +2 -0
- package/dist/lib/utils/formatters.js +5 -0
- package/dist/package.json +6 -5
- package/package.json +7 -6
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright ©
|
|
3
|
+
Copyright © 2026 Sergio Gotuzzo
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
6
|
|
package/dist/lib/Client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
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, type InviteTargetUsersJobStatusErrorCodes, type AuthorTypes, type SearchHasTypes, type SearchEmbedTypes, type SearchSortModes } from "./constants";
|
|
1
|
+
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, type InviteTargetUsersJobStatusErrorCodes, type AuthorTypes, type SearchHasTypes, type SearchEmbedTypes, type SearchSortModes, EntryPointCommandHandlerTypes, GatewayCapabilities } from "./constants";
|
|
2
2
|
import { RequestManager, type FileData } from "./rest";
|
|
3
3
|
import EventEmitter from "node:events";
|
|
4
4
|
import { Shard } from "./gateway";
|
|
@@ -26,17 +26,18 @@ import type { User, ApplicationRoleConnection, Connection } from "./types/user";
|
|
|
26
26
|
import type { VoiceRegion, VoiceState } from "./types/voice";
|
|
27
27
|
import type { Webhook } from "./types/webhook";
|
|
28
28
|
import type { ClientOptions as WebSocketOptions } from "ws";
|
|
29
|
-
import type { Embed, AllowedMentions, Attachment, Message, MessageReference, MessagePin, SharedClientTheme } from "./types/message";
|
|
29
|
+
import type { Embed, AllowedMentions, Attachment, Message, MessageReference, MessagePin, SharedClientTheme, AttachmentRequest } from "./types/message";
|
|
30
30
|
import type { Subscription } from "./types/subscription";
|
|
31
31
|
import type { SoundboardSound } from "./types/soundboard";
|
|
32
32
|
import type { ActionRow, Button, ChannelSelect, Container, File, MediaGallery, MentionableSelect, RoleSelect, Section, Separator, StringSelect, TextDisplay, Thumbnail, UserSelect } from "./types/components";
|
|
33
|
-
import type
|
|
33
|
+
import { LobbyInvite, type Lobby, type LobbyMember, type LobbyMessage } from "./types/lobby";
|
|
34
34
|
export interface GatewayOptions {
|
|
35
35
|
properties?: IdentifyConnectionProperties;
|
|
36
36
|
compress?: boolean;
|
|
37
37
|
largeThreshold?: number;
|
|
38
38
|
presence?: Partial<Pick<GatewayPresenceUpdate, "activities" | "status" | "afk">>;
|
|
39
39
|
intents?: number | Array<number>;
|
|
40
|
+
capabilities?: GatewayCapabilities;
|
|
40
41
|
}
|
|
41
42
|
export interface ClientOptions {
|
|
42
43
|
shardsCount?: number | "auto";
|
|
@@ -52,6 +53,7 @@ export declare class Client extends EventEmitter {
|
|
|
52
53
|
largeThreshold?: number;
|
|
53
54
|
presence?: Partial<Pick<GatewayPresenceUpdate, "activities" | "status" | "afk">>;
|
|
54
55
|
intents: GatewayIntents | number;
|
|
56
|
+
capabilities?: GatewayCapabilities;
|
|
55
57
|
shardsCount: number | "auto";
|
|
56
58
|
auth: "Bot" | "Bearer";
|
|
57
59
|
reconnect: boolean;
|
|
@@ -60,7 +62,7 @@ export declare class Client extends EventEmitter {
|
|
|
60
62
|
guildShardMap: Map<string, number>;
|
|
61
63
|
user: User | null;
|
|
62
64
|
guilds: Map<string, Guild>;
|
|
63
|
-
application: Pick<Application, "id" | "flags"> | null;
|
|
65
|
+
application: Pick<Application, "id" | "flags" | "flagsNew"> | null;
|
|
64
66
|
ws?: WebSocketOptions;
|
|
65
67
|
constructor(token: string, options?: ClientOptions);
|
|
66
68
|
/** https://discord.com/developers/docs/resources/channel#group-dm-add-recipient */
|
|
@@ -131,6 +133,13 @@ export declare class Client extends EventEmitter {
|
|
|
131
133
|
type?: ApplicationCommandTypes;
|
|
132
134
|
nsfw?: boolean;
|
|
133
135
|
}>): Promise<Array<ApplicationCommand>>;
|
|
136
|
+
/** https://docs.discord.com/developers/resources/lobby#bulk-update-lobby-members */
|
|
137
|
+
bulkUpdateLobbyMembers(lobbyId: snowflake, options: {
|
|
138
|
+
id: snowflake;
|
|
139
|
+
metadata?: Record<string, string> | null;
|
|
140
|
+
flags?: LobbyMemberFlags;
|
|
141
|
+
removeMember?: boolean;
|
|
142
|
+
}): Promise<Array<LobbyMember>>;
|
|
134
143
|
/** https://discord.com/developers/docs/topics/gateway#connections */
|
|
135
144
|
connect(): Promise<void>;
|
|
136
145
|
/** https://discord.com/developers/docs/resources/entitlement#consume-an-entitlement */
|
|
@@ -171,6 +180,7 @@ export declare class Client extends EventEmitter {
|
|
|
171
180
|
defaultSortOrder?: SortOrderTypes | null;
|
|
172
181
|
defaultForumLayout?: ForumLayoutTypes | null;
|
|
173
182
|
defaultThreadRateLimitPerUser?: number | null;
|
|
183
|
+
flags?: ChannelFlags;
|
|
174
184
|
}, reason?: string): Promise<Channel>;
|
|
175
185
|
/** https://discord.com/developers/docs/resources/channel#create-channel-invite */
|
|
176
186
|
createChannelInvite(channelId: snowflake, options: {
|
|
@@ -205,6 +215,7 @@ export declare class Client extends EventEmitter {
|
|
|
205
215
|
contexts?: Array<InteractionContextTypes>;
|
|
206
216
|
type?: ApplicationCommandTypes;
|
|
207
217
|
nsfw?: boolean;
|
|
218
|
+
handler?: EntryPointCommandHandlerTypes;
|
|
208
219
|
}): Promise<ApplicationCommand>;
|
|
209
220
|
/** https://discord.com/developers/docs/resources/user#create-group-dm */
|
|
210
221
|
createGroup(options: {
|
|
@@ -298,9 +309,15 @@ export declare class Client extends EventEmitter {
|
|
|
298
309
|
/** https://discord.com/developers/docs/resources/lobby#create-lobby */
|
|
299
310
|
createLobby(options?: {
|
|
300
311
|
metadata?: Record<string, string> | null;
|
|
301
|
-
members?: Array<Pick<LobbyMember, "id" | "metadata" | "flags"
|
|
312
|
+
members?: Array<Pick<LobbyMember, "id" | "metadata" | "flags"> & {
|
|
313
|
+
additionalName?: string | null;
|
|
314
|
+
}>;
|
|
302
315
|
idleTimeoutSeconds?: number;
|
|
303
316
|
}): Promise<Lobby>;
|
|
317
|
+
/** https://docs.discord.com/developers/resources/lobby#create-lobby-channel-invite-for-self */
|
|
318
|
+
createLobbyChannelSelfInvite(lobbyId: snowflake): Promise<LobbyInvite>;
|
|
319
|
+
/** https://docs.discord.com/developers/resources/lobby#create-lobby-channel-invite-for-user */
|
|
320
|
+
createLobbyChannelUserInvite(lobbyId: snowflake, userId: snowflake): Promise<LobbyInvite>;
|
|
304
321
|
/** https://discord.com/developers/docs/resources/message#create-message */
|
|
305
322
|
createMessage(channelId: snowflake, options: {
|
|
306
323
|
content?: string;
|
|
@@ -312,7 +329,7 @@ export declare class Client extends EventEmitter {
|
|
|
312
329
|
components?: Array<ActionRow | Section | TextDisplay | MediaGallery | File | Separator | Container>;
|
|
313
330
|
stickersIds?: Array<snowflake>;
|
|
314
331
|
files?: Array<FileData>;
|
|
315
|
-
attachments?: Array<
|
|
332
|
+
attachments?: Array<AttachmentRequest>;
|
|
316
333
|
flags?: MessageFlags;
|
|
317
334
|
enforceNonce?: boolean;
|
|
318
335
|
poll?: PollCreateParams;
|
|
@@ -345,7 +362,7 @@ export declare class Client extends EventEmitter {
|
|
|
345
362
|
allowedMentions?: AllowedMentions;
|
|
346
363
|
components?: Array<ActionRow | Button | StringSelect | UserSelect | RoleSelect | MentionableSelect | ChannelSelect | Section | TextDisplay | Thumbnail | MediaGallery | File | Separator | Container>;
|
|
347
364
|
stickerIds?: Array<snowflake>;
|
|
348
|
-
attachments?: Array<
|
|
365
|
+
attachments?: Array<AttachmentRequest>;
|
|
349
366
|
flags?: MessageFlags;
|
|
350
367
|
files?: Array<FileData>;
|
|
351
368
|
};
|
|
@@ -377,6 +394,8 @@ export declare class Client extends EventEmitter {
|
|
|
377
394
|
deleteChannel(channelId: snowflake, reason?: string): Promise<Channel>;
|
|
378
395
|
/** https://discord.com/developers/docs/resources/channel#delete-channel-permission */
|
|
379
396
|
deleteChannelPermission(channelId: snowflake, overwriteId: snowflake, reason?: string): void;
|
|
397
|
+
/** https://docs.discord.com/developers/resources/user#delete-current-user-application-role-connection */
|
|
398
|
+
deleteCurrentUserApplicationRoleConnection(applicationId: snowflake): void;
|
|
380
399
|
/** https://discord.com/developers/docs/interactions/application-commands#delete-global-application-command */
|
|
381
400
|
deleteGlobalApplicationCommand(applicationId: snowflake, commandId: snowflake): void;
|
|
382
401
|
/** https://discord.com/developers/docs/interactions/application-commands#delete-guild-application-command */
|
|
@@ -480,6 +499,7 @@ export declare class Client extends EventEmitter {
|
|
|
480
499
|
position?: number | null;
|
|
481
500
|
lockPermissions?: boolean | null;
|
|
482
501
|
parentId?: snowflake | null;
|
|
502
|
+
flags?: ChannelFlags;
|
|
483
503
|
}>): void;
|
|
484
504
|
/** https://discord.com/developers/docs/resources/user#modify-current-user */
|
|
485
505
|
editCurrentUser(options: {
|
|
@@ -524,6 +544,7 @@ export declare class Client extends EventEmitter {
|
|
|
524
544
|
integrationTypes?: Array<ApplicationIntegrationTypes>;
|
|
525
545
|
contexts?: Array<InteractionContextTypes>;
|
|
526
546
|
nsfw?: boolean;
|
|
547
|
+
handler?: EntryPointCommandHandlerTypes;
|
|
527
548
|
}): Promise<ApplicationCommand>;
|
|
528
549
|
/** https://discord.com/developers/docs/resources/guild#modify-guild */
|
|
529
550
|
editGuild(guildId: snowflake, options: {
|
|
@@ -646,7 +667,9 @@ export declare class Client extends EventEmitter {
|
|
|
646
667
|
/** https://discord.com/developers/docs/resources/lobby#modify-lobby */
|
|
647
668
|
editLobby(lobbyId: snowflake, options: {
|
|
648
669
|
metadata?: Record<string, string> | null;
|
|
649
|
-
members?: Array<Pick<LobbyMember, "id" | "metadata" | "flags"
|
|
670
|
+
members?: Array<Pick<LobbyMember, "id" | "metadata" | "flags"> & {
|
|
671
|
+
additionalName?: string | null;
|
|
672
|
+
}>;
|
|
650
673
|
idleTimeoutSeconds?: number;
|
|
651
674
|
}): Promise<Lobby>;
|
|
652
675
|
/** https://discord.com/developers/docs/resources/message#edit-message */
|
|
@@ -657,7 +680,7 @@ export declare class Client extends EventEmitter {
|
|
|
657
680
|
allowedMentions?: AllowedMentions | null;
|
|
658
681
|
components?: Array<ActionRow | Section | TextDisplay | MediaGallery | File | Separator | Container> | null;
|
|
659
682
|
files?: Array<FileData> | null;
|
|
660
|
-
attachments?: Array<
|
|
683
|
+
attachments?: Array<AttachmentRequest> | null;
|
|
661
684
|
}): Promise<Message>;
|
|
662
685
|
/** https://discord.com/developers/docs/resources/stage-instance#modify-stage-instance */
|
|
663
686
|
editStageInstance(channelId: snowflake, options: {
|
|
@@ -704,7 +727,7 @@ export declare class Client extends EventEmitter {
|
|
|
704
727
|
allowedMentions?: AllowedMentions | null;
|
|
705
728
|
components?: Array<ActionRow | Section | TextDisplay | MediaGallery | File | Separator | Container> | null;
|
|
706
729
|
files?: Array<FileData> | null;
|
|
707
|
-
attachments?: Array<
|
|
730
|
+
attachments?: Array<AttachmentRequest> | null;
|
|
708
731
|
poll?: PollCreateParams | null;
|
|
709
732
|
threadId?: snowflake;
|
|
710
733
|
withComponents?: boolean;
|
|
@@ -726,7 +749,7 @@ export declare class Client extends EventEmitter {
|
|
|
726
749
|
allowedMentions?: AllowedMentions;
|
|
727
750
|
components?: Array<ActionRow | Section | TextDisplay | MediaGallery | File | Separator | Container>;
|
|
728
751
|
files?: Array<FileData>;
|
|
729
|
-
attachments?: Array<
|
|
752
|
+
attachments?: Array<AttachmentRequest>;
|
|
730
753
|
flags?: MessageFlags;
|
|
731
754
|
threadName?: string;
|
|
732
755
|
appliedTags?: Array<snowflake>;
|
|
@@ -974,6 +997,10 @@ export declare class Client extends EventEmitter {
|
|
|
974
997
|
}>;
|
|
975
998
|
/** https://discord.com/developers/docs/resources/lobby#get-lobby */
|
|
976
999
|
getLobby(lobbyId: snowflake): Promise<Lobby>;
|
|
1000
|
+
/** https://docs.discord.com/developers/resources/lobby#get-lobby-messages */
|
|
1001
|
+
getLobbyMessages(lobbyId: snowflake, options?: {
|
|
1002
|
+
limit?: number;
|
|
1003
|
+
}): Promise<Array<LobbyMessage>>;
|
|
977
1004
|
/** https://discord.com/developers/docs/resources/message#get-channel-message */
|
|
978
1005
|
getMessage(channelId: snowflake, messageId: snowflake): Promise<Message>;
|
|
979
1006
|
/** https://discord.com/developers/docs/resources/message#get-reactions */
|
|
@@ -1054,6 +1081,13 @@ export declare class Client extends EventEmitter {
|
|
|
1054
1081
|
}): Promise<Message>;
|
|
1055
1082
|
/** https://discord.com/developers/docs/resources/webhook#get-guild-webhooks */
|
|
1056
1083
|
getWebhooks(guildId: snowflake): Promise<Array<Webhook>>;
|
|
1084
|
+
/** https://docs.discord.com/developers/resources/lobby#create-or-join-lobby */
|
|
1085
|
+
joinLobby(options: {
|
|
1086
|
+
secret: string;
|
|
1087
|
+
idleTimeoutSeconds?: number;
|
|
1088
|
+
lobbyMetadata?: Record<string, string> | null;
|
|
1089
|
+
memberMetadata?: Record<string, string> | null;
|
|
1090
|
+
}): Promise<Lobby>;
|
|
1057
1091
|
/** https://discord.com/developers/docs/resources/channel#join-thread */
|
|
1058
1092
|
joinThread(channelId: snowflake): void;
|
|
1059
1093
|
/** https://discord.com/developers/docs/topics/gateway-events#update-voice-state */
|
|
@@ -1126,6 +1160,12 @@ export declare class Client extends EventEmitter {
|
|
|
1126
1160
|
threads?: Array<Channel>;
|
|
1127
1161
|
members?: Array<ThreadMember>;
|
|
1128
1162
|
}>;
|
|
1163
|
+
/** https://docs.discord.com/developers/resources/lobby#send-lobby-message */
|
|
1164
|
+
sendLobbyMessage(lobbyId: snowflake, options: {
|
|
1165
|
+
content: string;
|
|
1166
|
+
metadata?: Record<string, string> | null;
|
|
1167
|
+
flags?: MessageFlags;
|
|
1168
|
+
}): Promise<LobbyMessage>;
|
|
1129
1169
|
/** https://discord.com/developers/docs/resources/soundboard#send-soundboard-sound */
|
|
1130
1170
|
sendSoundboardSound(channelId: snowflake, options: {
|
|
1131
1171
|
soundId: snowflake;
|
|
@@ -1153,6 +1193,8 @@ export declare class Client extends EventEmitter {
|
|
|
1153
1193
|
}): Promise<ApplicationRoleConnection>;
|
|
1154
1194
|
/** https://discord.com/developers/docs/resources/invite#update-target-users */
|
|
1155
1195
|
updateInviteTargetUser(inviteCode: string, targetUsersFile: FileData): void;
|
|
1196
|
+
/** https://docs.discord.com/developers/resources/lobby#update-lobby-message-moderation-metadata */
|
|
1197
|
+
updateLobbyMessageModerationMetadata(lobbyId: snowflake, messageId: snowflake, metadata: Record<string, string>): void;
|
|
1156
1198
|
/** https://discord.com/developers/docs/resources/channel#unpin-message */
|
|
1157
1199
|
unpinMessage(channelId: snowflake, messageId: snowflake, reason?: string): void;
|
|
1158
1200
|
}
|
package/dist/lib/Client.js
CHANGED
|
@@ -16,6 +16,7 @@ class Client extends node_events_1.default {
|
|
|
16
16
|
largeThreshold;
|
|
17
17
|
presence;
|
|
18
18
|
intents;
|
|
19
|
+
capabilities;
|
|
19
20
|
shardsCount;
|
|
20
21
|
auth;
|
|
21
22
|
reconnect;
|
|
@@ -39,6 +40,7 @@ class Client extends node_events_1.default {
|
|
|
39
40
|
? options.gateway.intents.reduce((sum, num) => sum + num, 0)
|
|
40
41
|
: options.gateway.intents
|
|
41
42
|
: 0;
|
|
43
|
+
this.capabilities = options?.gateway?.capabilities;
|
|
42
44
|
this.shardsCount = options?.shardsCount ?? "auto";
|
|
43
45
|
this.auth = options?.auth ?? "Bot";
|
|
44
46
|
this.reconnect = options?.reconnect ?? true;
|
|
@@ -159,6 +161,13 @@ class Client extends node_events_1.default {
|
|
|
159
161
|
});
|
|
160
162
|
return response.map((c) => transformers_1.ApplicationCommands.applicationCommandFromRaw(c));
|
|
161
163
|
}
|
|
164
|
+
/** https://docs.discord.com/developers/resources/lobby#bulk-update-lobby-members */
|
|
165
|
+
async bulkUpdateLobbyMembers(lobbyId, options) {
|
|
166
|
+
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.lobbyMembersBulk(lobbyId), {
|
|
167
|
+
json: options,
|
|
168
|
+
});
|
|
169
|
+
return response.map((lobbyMember) => transformers_1.Lobbies.lobbyMemberFromRaw(lobbyMember));
|
|
170
|
+
}
|
|
162
171
|
/** https://discord.com/developers/docs/topics/gateway#connections */
|
|
163
172
|
async connect() {
|
|
164
173
|
this.shardsCount =
|
|
@@ -228,6 +237,7 @@ class Client extends node_events_1.default {
|
|
|
228
237
|
default_sort_order: options.defaultSortOrder,
|
|
229
238
|
default_forum_layout: options.defaultForumLayout,
|
|
230
239
|
default_thread_rate_limit_per_user: options.defaultThreadRateLimitPerUser,
|
|
240
|
+
flags: options.flags,
|
|
231
241
|
},
|
|
232
242
|
reason,
|
|
233
243
|
});
|
|
@@ -287,6 +297,7 @@ class Client extends node_events_1.default {
|
|
|
287
297
|
contexts: options.contexts,
|
|
288
298
|
type: options.type,
|
|
289
299
|
nsfw: options.nsfw,
|
|
300
|
+
handler: options.handler,
|
|
290
301
|
},
|
|
291
302
|
});
|
|
292
303
|
return transformers_1.ApplicationCommands.applicationCommandFromRaw(response);
|
|
@@ -603,12 +614,27 @@ class Client extends node_events_1.default {
|
|
|
603
614
|
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.lobbies(), {
|
|
604
615
|
json: {
|
|
605
616
|
metadata: options?.metadata,
|
|
606
|
-
members: options?.members
|
|
617
|
+
members: options?.members?.map((member) => ({
|
|
618
|
+
id: member.id,
|
|
619
|
+
metadata: member.metadata,
|
|
620
|
+
flags: member.flags,
|
|
621
|
+
additional_name: member.additionalName,
|
|
622
|
+
})),
|
|
607
623
|
idle_timeout_seconds: options?.idleTimeoutSeconds,
|
|
608
624
|
},
|
|
609
625
|
});
|
|
610
626
|
return transformers_1.Lobbies.lobbyFromRaw(response);
|
|
611
627
|
}
|
|
628
|
+
/** https://docs.discord.com/developers/resources/lobby#create-lobby-channel-invite-for-self */
|
|
629
|
+
async createLobbyChannelSelfInvite(lobbyId) {
|
|
630
|
+
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.lobbyChannelInvite(lobbyId));
|
|
631
|
+
return response;
|
|
632
|
+
}
|
|
633
|
+
/** https://docs.discord.com/developers/resources/lobby#create-lobby-channel-invite-for-user */
|
|
634
|
+
async createLobbyChannelUserInvite(lobbyId, userId) {
|
|
635
|
+
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.lobbyChannelInvite(lobbyId, userId));
|
|
636
|
+
return response;
|
|
637
|
+
}
|
|
612
638
|
/** https://discord.com/developers/docs/resources/message#create-message */
|
|
613
639
|
async createMessage(channelId, options) {
|
|
614
640
|
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.channelMessages(channelId), {
|
|
@@ -637,7 +663,7 @@ class Client extends node_events_1.default {
|
|
|
637
663
|
? transformers_1.Messages.componentsToRaw(options.components)
|
|
638
664
|
: undefined,
|
|
639
665
|
stickers_ids: options.stickersIds,
|
|
640
|
-
attachments: options.attachments,
|
|
666
|
+
attachments: options.attachments?.map((attachment) => transformers_1.Channels.attachmentRequestToRaw(attachment)),
|
|
641
667
|
flags: options.flags,
|
|
642
668
|
enforce_nonce: options.enforceNonce,
|
|
643
669
|
poll: options.poll !== undefined
|
|
@@ -713,7 +739,7 @@ class Client extends node_events_1.default {
|
|
|
713
739
|
}
|
|
714
740
|
: undefined,
|
|
715
741
|
sticker_ids: options.message.stickerIds,
|
|
716
|
-
attachments: options.message.attachments,
|
|
742
|
+
attachments: options.message.attachments?.map((attachment) => transformers_1.Channels.attachmentRequestToRaw(attachment)),
|
|
717
743
|
flags: options.message.flags,
|
|
718
744
|
},
|
|
719
745
|
applied_tags: options.appliedTags,
|
|
@@ -781,6 +807,10 @@ class Client extends node_events_1.default {
|
|
|
781
807
|
reason,
|
|
782
808
|
});
|
|
783
809
|
}
|
|
810
|
+
/** https://docs.discord.com/developers/resources/user#delete-current-user-application-role-connection */
|
|
811
|
+
deleteCurrentUserApplicationRoleConnection(applicationId) {
|
|
812
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.userApplicationRoleConnection(applicationId));
|
|
813
|
+
}
|
|
784
814
|
/** https://discord.com/developers/docs/interactions/application-commands#delete-global-application-command */
|
|
785
815
|
deleteGlobalApplicationCommand(applicationId, commandId) {
|
|
786
816
|
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.applicationCommand(applicationId, commandId));
|
|
@@ -987,6 +1017,7 @@ class Client extends node_events_1.default {
|
|
|
987
1017
|
position: data.position,
|
|
988
1018
|
lock_permissions: data.lockPermissions,
|
|
989
1019
|
parent_id: data.parentId,
|
|
1020
|
+
flags: data.flags,
|
|
990
1021
|
})),
|
|
991
1022
|
});
|
|
992
1023
|
}
|
|
@@ -1059,6 +1090,7 @@ class Client extends node_events_1.default {
|
|
|
1059
1090
|
integration_types: options.integrationTypes,
|
|
1060
1091
|
contexts: options.contexts,
|
|
1061
1092
|
nsfw: options.nsfw,
|
|
1093
|
+
handler: options.handler,
|
|
1062
1094
|
},
|
|
1063
1095
|
});
|
|
1064
1096
|
return transformers_1.ApplicationCommands.applicationCommandFromRaw(response);
|
|
@@ -1310,7 +1342,12 @@ class Client extends node_events_1.default {
|
|
|
1310
1342
|
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.lobby(lobbyId), {
|
|
1311
1343
|
json: {
|
|
1312
1344
|
metadata: options.metadata,
|
|
1313
|
-
members: options.members
|
|
1345
|
+
members: options.members?.map((member) => ({
|
|
1346
|
+
id: member.id,
|
|
1347
|
+
metadata: member.metadata,
|
|
1348
|
+
flags: member.flags,
|
|
1349
|
+
additional_name: member.additionalName,
|
|
1350
|
+
})),
|
|
1314
1351
|
idle_timeout_seconds: options.idleTimeoutSeconds,
|
|
1315
1352
|
},
|
|
1316
1353
|
});
|
|
@@ -1339,7 +1376,7 @@ class Client extends node_events_1.default {
|
|
|
1339
1376
|
? transformers_1.Messages.componentsToRaw(options.components)
|
|
1340
1377
|
: null
|
|
1341
1378
|
: undefined,
|
|
1342
|
-
attachments: options.attachments?.map((attachment) => transformers_1.
|
|
1379
|
+
attachments: options.attachments?.map((attachment) => transformers_1.Channels.attachmentRequestToRaw(attachment)),
|
|
1343
1380
|
flags: options.flags,
|
|
1344
1381
|
},
|
|
1345
1382
|
files: options.files,
|
|
@@ -1523,22 +1560,7 @@ class Client extends node_events_1.default {
|
|
|
1523
1560
|
? transformers_1.Messages.componentsToRaw(options.components)
|
|
1524
1561
|
: null
|
|
1525
1562
|
: undefined,
|
|
1526
|
-
attachments: options.attachments?.map((attachment) => (
|
|
1527
|
-
id: attachment.id,
|
|
1528
|
-
filename: attachment.filename,
|
|
1529
|
-
title: attachment.title,
|
|
1530
|
-
description: attachment.description,
|
|
1531
|
-
content_type: attachment.contentType,
|
|
1532
|
-
size: attachment.size,
|
|
1533
|
-
url: attachment.url,
|
|
1534
|
-
proxy_url: attachment.proxyURL,
|
|
1535
|
-
height: attachment.height,
|
|
1536
|
-
width: attachment.width,
|
|
1537
|
-
ephemeral: attachment.ephemeral,
|
|
1538
|
-
duration_secs: attachment.durationSecs,
|
|
1539
|
-
waveform: attachment.waveform,
|
|
1540
|
-
flags: attachment.flags,
|
|
1541
|
-
})),
|
|
1563
|
+
attachments: options.attachments?.map((attachment) => transformers_1.Channels.attachmentRequestToRaw(attachment)),
|
|
1542
1564
|
poll: options.poll !== undefined
|
|
1543
1565
|
? options.poll !== null
|
|
1544
1566
|
? {
|
|
@@ -1599,7 +1621,7 @@ class Client extends node_events_1.default {
|
|
|
1599
1621
|
components: options.components !== undefined
|
|
1600
1622
|
? transformers_1.Messages.componentsToRaw(options.components)
|
|
1601
1623
|
: undefined,
|
|
1602
|
-
attachments: options.attachments,
|
|
1624
|
+
attachments: options.attachments?.map((attachment) => transformers_1.Channels.attachmentRequestToRaw(attachment)),
|
|
1603
1625
|
flags: options.flags,
|
|
1604
1626
|
thread_name: options.threadName,
|
|
1605
1627
|
applied_tags: options.appliedTags,
|
|
@@ -2177,7 +2199,9 @@ class Client extends node_events_1.default {
|
|
|
2177
2199
|
}
|
|
2178
2200
|
/** https://discord.com/developers/docs/resources/invite#get-target-users */
|
|
2179
2201
|
getInviteTargetUser(inviteCode) {
|
|
2180
|
-
return this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.inviteTargetUsers(inviteCode)
|
|
2202
|
+
return this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.inviteTargetUsers(inviteCode), {
|
|
2203
|
+
returnsBlob: true,
|
|
2204
|
+
});
|
|
2181
2205
|
}
|
|
2182
2206
|
async getInviteTargetUserJobStatus(inviteCode) {
|
|
2183
2207
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.inviteTargetUsersJobStatus(inviteCode));
|
|
@@ -2209,6 +2233,13 @@ class Client extends node_events_1.default {
|
|
|
2209
2233
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.lobby(lobbyId));
|
|
2210
2234
|
return transformers_1.Lobbies.lobbyFromRaw(response);
|
|
2211
2235
|
}
|
|
2236
|
+
/** https://docs.discord.com/developers/resources/lobby#get-lobby-messages */
|
|
2237
|
+
async getLobbyMessages(lobbyId, options) {
|
|
2238
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.lobbyMessages(lobbyId), {
|
|
2239
|
+
query: options,
|
|
2240
|
+
});
|
|
2241
|
+
return response.map((lobbyMessage) => transformers_1.Lobbies.lobbyMessageFromRaw(lobbyMessage));
|
|
2242
|
+
}
|
|
2212
2243
|
/** https://discord.com/developers/docs/resources/message#get-channel-message */
|
|
2213
2244
|
async getMessage(channelId, messageId) {
|
|
2214
2245
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channelMessage(channelId, messageId));
|
|
@@ -2389,6 +2420,18 @@ class Client extends node_events_1.default {
|
|
|
2389
2420
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildWebhooks(guildId));
|
|
2390
2421
|
return response.map((webhook) => transformers_1.Webhooks.webhookFromRaw(webhook));
|
|
2391
2422
|
}
|
|
2423
|
+
/** https://docs.discord.com/developers/resources/lobby#create-or-join-lobby */
|
|
2424
|
+
async joinLobby(options) {
|
|
2425
|
+
const response = await this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.lobbies(), {
|
|
2426
|
+
json: {
|
|
2427
|
+
secret: options.secret,
|
|
2428
|
+
idle_timeout_seconds: options.idleTimeoutSeconds,
|
|
2429
|
+
lobby_metadata: options.lobbyMetadata,
|
|
2430
|
+
member_metadata: options.memberMetadata,
|
|
2431
|
+
},
|
|
2432
|
+
});
|
|
2433
|
+
return transformers_1.Lobbies.lobbyFromRaw(response);
|
|
2434
|
+
}
|
|
2392
2435
|
/** https://discord.com/developers/docs/resources/channel#join-thread */
|
|
2393
2436
|
joinThread(channelId) {
|
|
2394
2437
|
this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.threadMembers(channelId));
|
|
@@ -2521,6 +2564,13 @@ class Client extends node_events_1.default {
|
|
|
2521
2564
|
members: response.members?.map((member) => transformers_1.Channels.threadMemberFromRaw(member)),
|
|
2522
2565
|
};
|
|
2523
2566
|
}
|
|
2567
|
+
/** https://docs.discord.com/developers/resources/lobby#send-lobby-message */
|
|
2568
|
+
async sendLobbyMessage(lobbyId, options) {
|
|
2569
|
+
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.lobbyMessages(lobbyId), {
|
|
2570
|
+
json: options,
|
|
2571
|
+
});
|
|
2572
|
+
return transformers_1.Lobbies.lobbyMessageFromRaw(response);
|
|
2573
|
+
}
|
|
2524
2574
|
/** https://discord.com/developers/docs/resources/soundboard#send-soundboard-sound */
|
|
2525
2575
|
sendSoundboardSound(channelId, options) {
|
|
2526
2576
|
this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.sendSoundboardSound(channelId), {
|
|
@@ -2583,6 +2633,12 @@ class Client extends node_events_1.default {
|
|
|
2583
2633
|
files: [targetUsersFile],
|
|
2584
2634
|
});
|
|
2585
2635
|
}
|
|
2636
|
+
/** https://docs.discord.com/developers/resources/lobby#update-lobby-message-moderation-metadata */
|
|
2637
|
+
updateLobbyMessageModerationMetadata(lobbyId, messageId, metadata) {
|
|
2638
|
+
this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.lobbyMessageModerationMetadata(lobbyId, messageId), {
|
|
2639
|
+
json: metadata,
|
|
2640
|
+
});
|
|
2641
|
+
}
|
|
2586
2642
|
/** https://discord.com/developers/docs/resources/channel#unpin-message */
|
|
2587
2643
|
unpinMessage(channelId, messageId, reason) {
|
|
2588
2644
|
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.channelPin(channelId, messageId), {
|
package/dist/lib/constants.d.ts
CHANGED
|
@@ -329,7 +329,9 @@ export declare enum VideoQualityModes {
|
|
|
329
329
|
export declare enum ChannelFlags {
|
|
330
330
|
Pinned = 2,
|
|
331
331
|
RequiredTag = 16,
|
|
332
|
-
HideMediaDownloadOptions = 32768
|
|
332
|
+
HideMediaDownloadOptions = 32768,
|
|
333
|
+
ChannelObfuscated = 131072,
|
|
334
|
+
IsSpoilerChannel = 2097152
|
|
333
335
|
}
|
|
334
336
|
/** https://discord.com/developers/docs/resources/channel#channel-object-sort-order-types */
|
|
335
337
|
export declare enum SortOrderTypes {
|
|
@@ -401,7 +403,10 @@ export declare enum GuildFeatures {
|
|
|
401
403
|
CreatorStorePage = "CREATOR_STORE_PAGE",
|
|
402
404
|
DeveloperSupportServer = "DEVELOPER_SUPPORT_SERVER",
|
|
403
405
|
Discoverable = "DISCOVERABLE",
|
|
406
|
+
EnhancedRoleColors = "ENHANCED_ROLE_COLORS",
|
|
404
407
|
Featurable = "FEATURABLE",
|
|
408
|
+
GuildTags = "GUILD_TAGS",
|
|
409
|
+
GuestsEnabled = "GUESTS_ENABLED",
|
|
405
410
|
InvitesDisabled = "INVITES_DISABLED",
|
|
406
411
|
InviteSplash = "INVITE_SPLASH",
|
|
407
412
|
MemberVerificationGateEnabled = "MEMBER_VERIFICATION_GATE_ENABLED",
|
|
@@ -410,6 +415,7 @@ export declare enum GuildFeatures {
|
|
|
410
415
|
News = "NEWS",
|
|
411
416
|
Partnered = "PARTNERED",
|
|
412
417
|
PreviewEnabled = "PREVIEW_ENABLED",
|
|
418
|
+
PruneRequiresAdmin = "PRUNE_REQUIRES_ADMIN",
|
|
413
419
|
RaidAlertsDisabled = "RAID_ALERTS_DISABLED",
|
|
414
420
|
RoleIcons = "ROLE_ICONS",
|
|
415
421
|
RoleSubscriptionsAvailableForPurchase = "ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE",
|
|
@@ -419,10 +425,7 @@ export declare enum GuildFeatures {
|
|
|
419
425
|
VanityURL = "VANITY_URL",
|
|
420
426
|
Verified = "VERIFIED",
|
|
421
427
|
VipRegions = "VIP_REGIONS",
|
|
422
|
-
WelcomeScreenEnabled = "WELCOME_SCREEN_ENABLED"
|
|
423
|
-
GuestsEnabled = "GUESTS_ENABLED",
|
|
424
|
-
GuildTags = "GUILD_TAGS",
|
|
425
|
-
EnhancedRoleColors = "ENHANCED_ROLE_COLORS"
|
|
428
|
+
WelcomeScreenEnabled = "WELCOME_SCREEN_ENABLED"
|
|
426
429
|
}
|
|
427
430
|
/** https://discord.com/developers/docs/resources/guild#guild-object-mutable-guild-features */
|
|
428
431
|
export declare enum MutableGuildFeatures {
|
|
@@ -587,7 +590,8 @@ export declare enum MessageActivityTypes {
|
|
|
587
590
|
Join = 1,
|
|
588
591
|
Spectate = 2,
|
|
589
592
|
Listen = 3,
|
|
590
|
-
JoinRequest = 5
|
|
593
|
+
JoinRequest = 5,
|
|
594
|
+
StreamRequest = 6
|
|
591
595
|
}
|
|
592
596
|
/** https://discord.com/developers/docs/resources/message#message-object-message-flags */
|
|
593
597
|
export declare enum MessageFlags {
|
|
@@ -769,8 +773,8 @@ export declare enum VisibilityTypes {
|
|
|
769
773
|
/** https://discord.com/developers/docs/resources/subscription#subscription-statuses */
|
|
770
774
|
export declare enum SubscriptionStatuses {
|
|
771
775
|
Active = 0,
|
|
772
|
-
|
|
773
|
-
|
|
776
|
+
Inactive = 1,
|
|
777
|
+
Ending = 2
|
|
774
778
|
}
|
|
775
779
|
/** https://discord.com/developers/docs/resources/webhook#webhook-object-webhook-types */
|
|
776
780
|
export declare enum WebhookTypes {
|
|
@@ -819,6 +823,10 @@ export declare enum StatusTypes {
|
|
|
819
823
|
Invisible = "invisible",
|
|
820
824
|
Offline = "offline"
|
|
821
825
|
}
|
|
826
|
+
/** https://docs.discord.com/developers/events/gateway-events#identify-gateway-capabilities */
|
|
827
|
+
export declare enum GatewayCapabilities {
|
|
828
|
+
ChannelObfuscation = 32768
|
|
829
|
+
}
|
|
822
830
|
/** https://discord.com/developers/docs/topics/gateway-events#receive-events */
|
|
823
831
|
export declare enum GatewayEvents {
|
|
824
832
|
Ready = "READY",
|
|
@@ -947,6 +955,7 @@ export declare enum OAuth2Scopes {
|
|
|
947
955
|
GuildsJoin = "guilds.join",
|
|
948
956
|
GuildsMembersRead = "guilds.members.read",
|
|
949
957
|
Identify = "identify",
|
|
958
|
+
IdentifyPremium = "identify.premium",
|
|
950
959
|
MessagesRead = "messages.read",
|
|
951
960
|
RelationShipsRead = "relationships.read",
|
|
952
961
|
RoleConnectionsWrite = "role_connections.write",
|
|
@@ -1092,8 +1101,8 @@ export declare enum JSONErrorCodes {
|
|
|
1092
1101
|
OnlyBotsCanUseThisEndpoint = 20002,
|
|
1093
1102
|
ExplicitContentCannotBeSentToTheDesiredRecipient = 20009,
|
|
1094
1103
|
NotAuthorizedToPerformThisActionOnThisApplication = 20012,
|
|
1104
|
+
ThisActionRequiresAPremiumSubscription = 20015,
|
|
1095
1105
|
ActionCannotBePerformedDueToSlowmodeRateLimit = 20016,
|
|
1096
|
-
TheMazeIsntMeantForYou = 20017,
|
|
1097
1106
|
OnlyTheOwnerOfThisAccountCanPerformThisAction = 20018,
|
|
1098
1107
|
AnnouncementEditLimitExceeded = 20022,
|
|
1099
1108
|
UnderMinimumAge = 20024,
|
|
@@ -1142,6 +1151,7 @@ export declare enum JSONErrorCodes {
|
|
|
1142
1151
|
RequestEntityTooLarge = 40005,
|
|
1143
1152
|
FeatureTemporarilyDisabledServerSide = 40006,
|
|
1144
1153
|
UserBannedFromThisGuild = 40007,
|
|
1154
|
+
OnlyOneChannelCanHaveAParentIdModifiedAtATime = 40009,
|
|
1145
1155
|
ConnectionHasBeenRevoked = 40012,
|
|
1146
1156
|
OnlyConsumableSKUsCanBeConsumed = 40018,
|
|
1147
1157
|
YouCanOnlyDeleteSandboxEntitlements = 40019,
|
|
@@ -1225,6 +1235,7 @@ export declare enum JSONErrorCodes {
|
|
|
1225
1235
|
VoiceMessagesMustHaveSupportingMetadata = 50161,
|
|
1226
1236
|
VoiceMessagesCannotBeEdited = 50162,
|
|
1227
1237
|
CannotDeleteGuildSubscriptionIntegration = 50163,
|
|
1238
|
+
CannotSendVoiceEffectWhenUserIsServerMutedDeafenedOrSuppressed = 50167,
|
|
1228
1239
|
YouCannotSendVoiceMessagesInThisChannel = 50173,
|
|
1229
1240
|
TheUserAccountMustFirstBeVerified = 50178,
|
|
1230
1241
|
TheProvidedFileDoesNotHaveAValidDuration = 50192,
|
|
@@ -1260,6 +1271,7 @@ export declare enum JSONErrorCodes {
|
|
|
1260
1271
|
WebhooksCanOnlyCreateThreadsInForumChannels = 220003,
|
|
1261
1272
|
WebhookServicesCannotBeUsedInForumChannels = 220004,
|
|
1262
1273
|
MessageBlockedByHarmfulLinksFilter = 240000,
|
|
1274
|
+
AccessToJoiningNewServersHasBeenLimitedForTheUser = 340015,
|
|
1263
1275
|
CannotEnableOnboardingRequirementsAreNotMet = 350000,
|
|
1264
1276
|
CannotUpdateOnboardingWhileBelowRequirements = 350001,
|
|
1265
1277
|
AccessToFileUploadsHasBeenLimitedForThisGuild = 400001,
|