disgroove 3.0.1-dev.739a5a9 → 3.0.1-dev.a547862

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.
Files changed (38) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +38 -8
  3. package/dist/lib/Client.d.ts +78 -4
  4. package/dist/lib/Client.js +110 -1
  5. package/dist/lib/constants.d.ts +78 -5
  6. package/dist/lib/constants.js +84 -2
  7. package/dist/lib/gateway/Dispatcher.d.ts +4 -1
  8. package/dist/lib/gateway/Dispatcher.js +25 -0
  9. package/dist/lib/gateway/Transmitter.d.ts +3 -1
  10. package/dist/lib/gateway/Transmitter.js +7 -0
  11. package/dist/lib/rest/Endpoints.d.ts +7 -1
  12. package/dist/lib/rest/Endpoints.js +15 -3
  13. package/dist/lib/rest/RequestManager.d.ts +1 -0
  14. package/dist/lib/rest/RequestManager.js +2 -3
  15. package/dist/lib/transformers/Applications.js +2 -0
  16. package/dist/lib/transformers/AuditLogs.js +2 -0
  17. package/dist/lib/transformers/Components.d.ts +7 -1
  18. package/dist/lib/transformers/Components.js +80 -0
  19. package/dist/lib/transformers/Guilds.js +10 -0
  20. package/dist/lib/transformers/Interactions.js +46 -0
  21. package/dist/lib/transformers/Invites.d.ts +3 -0
  22. package/dist/lib/transformers/Invites.js +32 -0
  23. package/dist/lib/transformers/Lobbies.d.ts +3 -1
  24. package/dist/lib/transformers/Lobbies.js +29 -0
  25. package/dist/lib/transformers/Messages.d.ts +1 -1
  26. package/dist/lib/transformers/Messages.js +78 -20
  27. package/dist/lib/transformers/Users.d.ts +3 -1
  28. package/dist/lib/transformers/Users.js +16 -10
  29. package/dist/lib/types/application.d.ts +4 -2
  30. package/dist/lib/types/audit-log.d.ts +2 -0
  31. package/dist/lib/types/components.d.ts +133 -7
  32. package/dist/lib/types/gateway-events.d.ts +64 -2
  33. package/dist/lib/types/guild.d.ts +3 -1
  34. package/dist/lib/types/invite.d.ts +2 -2
  35. package/dist/lib/types/lobby.d.ts +36 -1
  36. package/dist/lib/types/message.d.ts +66 -1
  37. package/dist/package.json +4 -3
  38. package/package.json +5 -4
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright © 2024 XenKys
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/README.md CHANGED
@@ -1,14 +1,42 @@
1
1
  # disgroove
2
2
 
3
- A module to interface with Discord
3
+ > A lightweight (≈ **791 KB** unpacked) and low-level Node.js dependency for interfacing with Discord, focused on accuracy and flexibility.
4
+ > It is designed for developers who want full control over the Discord API without heavy abstractions and want as little RAM and CPU usage as possible.
4
5
 
5
- - Fast
6
- - Lightweight
7
- - Flexible
8
- - 100% coverage of the [Official Discord API Documentation](https://discord.com/developers/docs/intro)
6
+ > **disgroove** is intended for developers already familiar with the Discord API and gateway model.
9
7
 
10
- ## Example
8
+ ## Why disgroove?
9
+
10
+ ### ✅ Accurate with the official Discord API
11
+
12
+ All commits (since __July 3, 2024__), types, REST requests, and utilities strictly follow the [official Discord API documentation repository](https://github.com/discord/discord-api-docs) and are referenced to the [Discord API developer docs](https://docs.discord.com/developers/intro).
13
+
14
+ Development releases are mainly published when breaking changes are introduced in the Discord API.
15
+
16
+ ---
17
+
18
+ ### 🧠 Minimal caching
19
+
20
+ **disgroove** only caches guilds.
21
+
22
+ Guilds are mapped from the `READY` gateway event and kept in sync through
23
+ `GUILD_CREATE`, `GUILD_UPDATE` and `GUILD_DELETE` gateway events.
24
+
25
+ This design significantly decreases RAM and CPU usage and keeps the library lightweight.
11
26
 
27
+ ---
28
+
29
+ ### 🔧 Highly flexible and low-level
30
+
31
+ **disgroove** doesn't hide Discord features behind abstractions.
32
+
33
+ Every REST request is built directly on top of the [Discord API developer docs](https://docs.discord.com/developers/intro), with no changes.
34
+
35
+ You can listen to any gateway event directly using `Shard.ws.on(...)` and perform raw REST requests using `Client.rest.request(...)`
36
+
37
+ This allows you to use new Discord features immediately, even before a dedicated **disgroove** update is released.
38
+
39
+ ## Example
12
40
  ```js
13
41
  const {
14
42
  Client,
@@ -17,7 +45,7 @@ const {
17
45
  InteractionCallbackType,
18
46
  MessageFlags,
19
47
  } = require("disgroove");
20
- const client = new Client("B0t.T0k3N");
48
+ const client = new Client(process.env.TOKEN);
21
49
 
22
50
  client.once("ready", () => {
23
51
  console.log("Logged in as", client.user.username);
@@ -28,7 +56,7 @@ client.once("ready", () => {
28
56
  });
29
57
  });
30
58
 
31
- client.on("interactionCreate", async (interaction) => {
59
+ client.on("interactionCreate", (interaction) => {
32
60
  if (interaction.type !== InteractionType.ApplicationCommand) return;
33
61
 
34
62
  if (interaction.data.name === "ping") {
@@ -46,3 +74,5 @@ client.connect();
46
74
  ```
47
75
 
48
76
  More examples on the [GitHub repository](https://github.com/sergiogotuzzo/disgroove/tree/main/examples)
77
+
78
+ > Enjoy **disgroove**? Leave a ⭐ to this repository!
@@ -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, InviteTargetUsersJobStatusErrorCodes } 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 } from "./constants";
2
2
  import { RequestManager, type FileData } from "./rest";
3
3
  import EventEmitter from "node:events";
4
4
  import { Shard } from "./gateway";
@@ -11,7 +11,7 @@ import type { Channel, FollowedChannel, ThreadMember, Overwrite, DefaultReaction
11
11
  import type { LocaleMap, snowflake, timestamp } from "./types/common";
12
12
  import type { Emoji } from "./types/emoji";
13
13
  import type { Entitlement } from "./types/entitlements";
14
- import type { AutoModerationActionExecutionEvent, ChannelPinsUpdateEvent, ThreadListSyncEvent, ThreadMemberUpdateEventExtra, ThreadMembersUpdateEvent, GuildCreateEventExtra, GuildAuditLogEntryCreateExtra, GuildBanAddEvent, GuildBanRemoveEvent, GuildMemberAddEventExtra, GuildMemberRemoveEvent, GuildMemberUpdateEvent, GuildMembersChunkEvent, IntegrationCreateEventExtra, IntegrationUpdateEventExtra, IntegrationDeleteEvent, InviteCreateEvent, InviteDeleteEvent, MessageCreateEventExtra, MessageDeleteEvent, MessageDeleteBulkEvent, MessageReactionAddEvent, MessageReactionRemoveEvent, MessageReactionRemoveAllEvent, MessageReactionRemoveEmojiEvent, PresenceUpdateEvent, TypingStartEvent, VoiceServerUpdateEvent, MessagePollVoteAddEvent, MessagePollVoteRemoveEvent, GatewayPresenceUpdate, RawPayload, IdentifyConnectionProperties, VoiceChannelEffectSendEvent, GuildSoundboardSoundDeleteEvent, RateLimitedEvent } from "./types/gateway-events";
14
+ import type { AutoModerationActionExecutionEvent, ChannelPinsUpdateEvent, ThreadListSyncEvent, ThreadMemberUpdateEventExtra, ThreadMembersUpdateEvent, GuildCreateEventExtra, GuildAuditLogEntryCreateExtra, GuildBanAddEvent, GuildBanRemoveEvent, GuildMemberAddEventExtra, GuildMemberRemoveEvent, GuildMemberUpdateEvent, GuildMembersChunkEvent, IntegrationCreateEventExtra, IntegrationUpdateEventExtra, IntegrationDeleteEvent, InviteCreateEvent, InviteDeleteEvent, MessageCreateEventExtra, MessageDeleteEvent, MessageDeleteBulkEvent, MessageReactionAddEvent, MessageReactionRemoveEvent, MessageReactionRemoveAllEvent, MessageReactionRemoveEmojiEvent, PresenceUpdateEvent, TypingStartEvent, VoiceServerUpdateEvent, MessagePollVoteAddEvent, MessagePollVoteRemoveEvent, GatewayPresenceUpdate, RawPayload, IdentifyConnectionProperties, VoiceChannelEffectSendEvent, GuildSoundboardSoundDeleteEvent, RateLimitedEvent, ChannelInfoEvent, VoiceChannelStatusUpdateEvent, VoiceChannelStartTimeUpdateEvent } from "./types/gateway-events";
15
15
  import type { Guild, GuildMember, WelcomeScreen, GuildWidgetSettings, Ban, Integration, GuildOnboarding, GuildPreview, GuildWidget, UnavailableGuild, OnboardingPrompt, WelcomeScreenChannel, IncidentsData } from "./types/guild";
16
16
  import type { GuildScheduledEvent, GuildScheduledEventUser, GuildScheduledEventEntityMetadata, GuildScheduledEventRecurrenceRule } from "./types/guild-scheduled-event";
17
17
  import type { GuildTemplate } from "./types/guild-template";
@@ -26,11 +26,11 @@ 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 } from "./types/message";
29
+ import type { Embed, AllowedMentions, Attachment, Message, MessageReference, MessagePin, SharedClientTheme } 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 { Lobby, LobbyMember } from "./types/lobby";
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;
@@ -131,6 +131,13 @@ export declare class Client extends EventEmitter {
131
131
  type?: ApplicationCommandTypes;
132
132
  nsfw?: boolean;
133
133
  }>): Promise<Array<ApplicationCommand>>;
134
+ /** https://docs.discord.com/developers/resources/lobby#bulk-update-lobby-members */
135
+ bulkUpdateLobbyMembers(lobbyId: snowflake, options: {
136
+ id: snowflake;
137
+ metadata?: Record<string, string> | null;
138
+ flags?: LobbyMemberFlags;
139
+ removeMember?: boolean;
140
+ }): Promise<Array<LobbyMember>>;
134
141
  /** https://discord.com/developers/docs/topics/gateway#connections */
135
142
  connect(): Promise<void>;
136
143
  /** https://discord.com/developers/docs/resources/entitlement#consume-an-entitlement */
@@ -301,6 +308,10 @@ export declare class Client extends EventEmitter {
301
308
  members?: Array<Pick<LobbyMember, "id" | "metadata" | "flags">>;
302
309
  idleTimeoutSeconds?: number;
303
310
  }): Promise<Lobby>;
311
+ /** https://docs.discord.com/developers/resources/lobby#create-lobby-channel-invite-for-self */
312
+ createLobbyChannelSelfInvite(lobbyId: snowflake): Promise<LobbyInvite>;
313
+ /** https://docs.discord.com/developers/resources/lobby#create-lobby-channel-invite-for-user */
314
+ createLobbyChannelUserInvite(lobbyId: snowflake, userId: snowflake): Promise<LobbyInvite>;
304
315
  /** https://discord.com/developers/docs/resources/message#create-message */
305
316
  createMessage(channelId: snowflake, options: {
306
317
  content?: string;
@@ -316,6 +327,7 @@ export declare class Client extends EventEmitter {
316
327
  flags?: MessageFlags;
317
328
  enforceNonce?: boolean;
318
329
  poll?: PollCreateParams;
330
+ sharedClientTheme?: SharedClientTheme;
319
331
  }): Promise<Message>;
320
332
  /** https://discord.com/developers/docs/resources/message#create-reaction */
321
333
  createMessageReaction(channelId: snowflake, messageId: snowflake, emoji: string): void;
@@ -376,6 +388,8 @@ export declare class Client extends EventEmitter {
376
388
  deleteChannel(channelId: snowflake, reason?: string): Promise<Channel>;
377
389
  /** https://discord.com/developers/docs/resources/channel#delete-channel-permission */
378
390
  deleteChannelPermission(channelId: snowflake, overwriteId: snowflake, reason?: string): void;
391
+ /** https://docs.discord.com/developers/resources/user#delete-current-user-application-role-connection */
392
+ deleteCurrentUserApplicationRoleConnection(applicationId: snowflake): void;
379
393
  /** https://discord.com/developers/docs/interactions/application-commands#delete-global-application-command */
380
394
  deleteGlobalApplicationCommand(applicationId: snowflake, commandId: snowflake): void;
381
395
  /** https://discord.com/developers/docs/interactions/application-commands#delete-guild-application-command */
@@ -973,6 +987,10 @@ export declare class Client extends EventEmitter {
973
987
  }>;
974
988
  /** https://discord.com/developers/docs/resources/lobby#get-lobby */
975
989
  getLobby(lobbyId: snowflake): Promise<Lobby>;
990
+ /** https://docs.discord.com/developers/resources/lobby#get-lobby-messages */
991
+ getLobbyMessages(lobbyId: snowflake, options?: {
992
+ limit?: number;
993
+ }): Promise<Array<LobbyMessage>>;
976
994
  /** https://discord.com/developers/docs/resources/message#get-channel-message */
977
995
  getMessage(channelId: snowflake, messageId: snowflake): Promise<Message>;
978
996
  /** https://discord.com/developers/docs/resources/message#get-reactions */
@@ -1053,6 +1071,13 @@ export declare class Client extends EventEmitter {
1053
1071
  }): Promise<Message>;
1054
1072
  /** https://discord.com/developers/docs/resources/webhook#get-guild-webhooks */
1055
1073
  getWebhooks(guildId: snowflake): Promise<Array<Webhook>>;
1074
+ /** https://docs.discord.com/developers/resources/lobby#create-or-join-lobby */
1075
+ joinLobby(options: {
1076
+ secret: string;
1077
+ idleTimeoutSeconds?: number;
1078
+ lobbyMetadata?: Record<string, string> | null;
1079
+ memberMetadata?: Record<string, string> | null;
1080
+ }): Promise<Lobby>;
1056
1081
  /** https://discord.com/developers/docs/resources/channel#join-thread */
1057
1082
  joinThread(channelId: snowflake): void;
1058
1083
  /** https://discord.com/developers/docs/topics/gateway-events#update-voice-state */
@@ -1091,6 +1116,46 @@ export declare class Client extends EventEmitter {
1091
1116
  query: string;
1092
1117
  limit?: number;
1093
1118
  }): Promise<Array<GuildMember>>;
1119
+ /** https://docs.discord.com/developers/resources/message#search-guild-messages */
1120
+ searchGuildMessages(guildId: snowflake, options?: {
1121
+ limit?: number;
1122
+ offset?: number;
1123
+ maxId?: snowflake;
1124
+ minId?: snowflake;
1125
+ slop?: number;
1126
+ content?: string;
1127
+ channelId?: snowflake;
1128
+ authorType?: Array<AuthorTypes>;
1129
+ authorId?: Array<snowflake>;
1130
+ mentions?: Array<snowflake>;
1131
+ mentionsRolesId?: Array<snowflake>;
1132
+ mentionEveryone?: boolean;
1133
+ repliedToUserId?: Array<snowflake>;
1134
+ repliedToMessageId?: Array<snowflake>;
1135
+ pinned?: boolean;
1136
+ has?: Array<SearchHasTypes>;
1137
+ embedType?: Array<SearchEmbedTypes>;
1138
+ embedProvider?: Array<string>;
1139
+ linkHostname?: Array<string>;
1140
+ attachmentFilename?: Array<string>;
1141
+ attachmentExtension?: Array<string>;
1142
+ sortBy?: SearchSortModes;
1143
+ sortOrder?: string;
1144
+ includeNfsw?: boolean;
1145
+ }): Promise<{
1146
+ doingDeepHistoricalIndex: boolean;
1147
+ documentsIndexed?: number;
1148
+ totalResults: number;
1149
+ messages: Array<Message>;
1150
+ threads?: Array<Channel>;
1151
+ members?: Array<ThreadMember>;
1152
+ }>;
1153
+ /** https://docs.discord.com/developers/resources/lobby#send-lobby-message */
1154
+ sendLobbyMessage(lobbyId: snowflake, options: {
1155
+ content: string;
1156
+ metadata?: Record<string, string> | null;
1157
+ flags?: MessageFlags;
1158
+ }): Promise<LobbyMessage>;
1094
1159
  /** https://discord.com/developers/docs/resources/soundboard#send-soundboard-sound */
1095
1160
  sendSoundboardSound(channelId: snowflake, options: {
1096
1161
  soundId: snowflake;
@@ -1098,6 +1163,10 @@ export declare class Client extends EventEmitter {
1098
1163
  }): void;
1099
1164
  /** https://discord.com/developers/docs/topics/gateway-events#update-presence */
1100
1165
  setPresence(options: Partial<Pick<GatewayPresenceUpdate, "activities" | "status" | "afk">>): void;
1166
+ /** https://docs.discord.com/developers/resources/channel#set-voice-channel-status */
1167
+ setVoiceChannelStatus(channelId: snowflake, options: {
1168
+ status: string | null;
1169
+ }, reason?: string): void;
1101
1170
  /** https://discord.com/developers/docs/resources/guild-template#sync-guild-template */
1102
1171
  syncGuildTemplate(guildId: snowflake, code: string): Promise<GuildTemplate>;
1103
1172
  /** https://discord.com/developers/docs/resources/channel#trigger-typing-indicator */
@@ -1114,6 +1183,8 @@ export declare class Client extends EventEmitter {
1114
1183
  }): Promise<ApplicationRoleConnection>;
1115
1184
  /** https://discord.com/developers/docs/resources/invite#update-target-users */
1116
1185
  updateInviteTargetUser(inviteCode: string, targetUsersFile: FileData): void;
1186
+ /** https://docs.discord.com/developers/resources/lobby#update-lobby-message-moderation-metadata */
1187
+ updateLobbyMessageModerationMetadata(lobbyId: snowflake, messageId: snowflake, metadata: Record<string, string>): void;
1117
1188
  /** https://discord.com/developers/docs/resources/channel#unpin-message */
1118
1189
  unpinMessage(channelId: snowflake, messageId: snowflake, reason?: string): void;
1119
1190
  }
@@ -1153,6 +1224,7 @@ export interface ClientEvents {
1153
1224
  channelCreate: [channel: Channel];
1154
1225
  channelUpdate: [channel: Channel];
1155
1226
  channelDelete: [channel: Channel];
1227
+ channelInfo: [info: ChannelInfoEvent];
1156
1228
  channelPinsUpdate: [pins: ChannelPinsUpdateEvent];
1157
1229
  threadCreate: [thread: Channel];
1158
1230
  threadUpdate: [thread: Channel];
@@ -1228,6 +1300,8 @@ export interface ClientEvents {
1228
1300
  typingStart: [typing: TypingStartEvent];
1229
1301
  userUpdate: [user: User];
1230
1302
  voiceChannelEffectSend: [voiceEffect: VoiceChannelEffectSendEvent];
1303
+ voiceChannelStatusUpdate: [voiceChannel: VoiceChannelStatusUpdateEvent];
1304
+ voiceChannelStartTimeUpdate: [voiceChannel: VoiceChannelStartTimeUpdateEvent];
1231
1305
  voiceStateUpdate: [voiceState: VoiceState];
1232
1306
  voiceServerUpdate: [voiceServer: VoiceServerUpdateEvent];
1233
1307
  webhooksUpdate: [channelId: snowflake, guildId: snowflake];
@@ -159,6 +159,13 @@ class Client extends node_events_1.default {
159
159
  });
160
160
  return response.map((c) => transformers_1.ApplicationCommands.applicationCommandFromRaw(c));
161
161
  }
162
+ /** https://docs.discord.com/developers/resources/lobby#bulk-update-lobby-members */
163
+ async bulkUpdateLobbyMembers(lobbyId, options) {
164
+ const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.lobbyMembersBulk(lobbyId), {
165
+ json: options,
166
+ });
167
+ return response.map((lobbyMember) => transformers_1.Lobbies.lobbyMemberFromRaw(lobbyMember));
168
+ }
162
169
  /** https://discord.com/developers/docs/topics/gateway#connections */
163
170
  async connect() {
164
171
  this.shardsCount =
@@ -609,6 +616,16 @@ class Client extends node_events_1.default {
609
616
  });
610
617
  return transformers_1.Lobbies.lobbyFromRaw(response);
611
618
  }
619
+ /** https://docs.discord.com/developers/resources/lobby#create-lobby-channel-invite-for-self */
620
+ async createLobbyChannelSelfInvite(lobbyId) {
621
+ const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.lobbyChannelInvite(lobbyId));
622
+ return response;
623
+ }
624
+ /** https://docs.discord.com/developers/resources/lobby#create-lobby-channel-invite-for-user */
625
+ async createLobbyChannelUserInvite(lobbyId, userId) {
626
+ const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.lobbyChannelInvite(lobbyId, userId));
627
+ return response;
628
+ }
612
629
  /** https://discord.com/developers/docs/resources/message#create-message */
613
630
  async createMessage(channelId, options) {
614
631
  const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.channelMessages(channelId), {
@@ -652,6 +669,14 @@ class Client extends node_events_1.default {
652
669
  layout_type: options.poll.layoutType,
653
670
  }
654
671
  : undefined,
672
+ shared_client_theme: options.sharedClientTheme !== undefined
673
+ ? {
674
+ colors: options.sharedClientTheme.colors,
675
+ gradient_angle: options.sharedClientTheme.gradientAngle,
676
+ base_mix: options.sharedClientTheme.baseMix,
677
+ base_theme: options.sharedClientTheme.baseTheme,
678
+ }
679
+ : undefined,
655
680
  },
656
681
  files: options.files,
657
682
  });
@@ -773,6 +798,10 @@ class Client extends node_events_1.default {
773
798
  reason,
774
799
  });
775
800
  }
801
+ /** https://docs.discord.com/developers/resources/user#delete-current-user-application-role-connection */
802
+ deleteCurrentUserApplicationRoleConnection(applicationId) {
803
+ this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.userApplicationRoleConnection(applicationId));
804
+ }
776
805
  /** https://discord.com/developers/docs/interactions/application-commands#delete-global-application-command */
777
806
  deleteGlobalApplicationCommand(applicationId, commandId) {
778
807
  this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.applicationCommand(applicationId, commandId));
@@ -2169,7 +2198,9 @@ class Client extends node_events_1.default {
2169
2198
  }
2170
2199
  /** https://discord.com/developers/docs/resources/invite#get-target-users */
2171
2200
  getInviteTargetUser(inviteCode) {
2172
- return this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.inviteTargetUsers(inviteCode));
2201
+ return this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.inviteTargetUsers(inviteCode), {
2202
+ returnsBlob: true,
2203
+ });
2173
2204
  }
2174
2205
  async getInviteTargetUserJobStatus(inviteCode) {
2175
2206
  const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.inviteTargetUsersJobStatus(inviteCode));
@@ -2201,6 +2232,13 @@ class Client extends node_events_1.default {
2201
2232
  const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.lobby(lobbyId));
2202
2233
  return transformers_1.Lobbies.lobbyFromRaw(response);
2203
2234
  }
2235
+ /** https://docs.discord.com/developers/resources/lobby#get-lobby-messages */
2236
+ async getLobbyMessages(lobbyId, options) {
2237
+ const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.lobbyMessages(lobbyId), {
2238
+ query: options,
2239
+ });
2240
+ return response.map((lobbyMessage) => transformers_1.Lobbies.lobbyMessageFromRaw(lobbyMessage));
2241
+ }
2204
2242
  /** https://discord.com/developers/docs/resources/message#get-channel-message */
2205
2243
  async getMessage(channelId, messageId) {
2206
2244
  const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.channelMessage(channelId, messageId));
@@ -2381,6 +2419,18 @@ class Client extends node_events_1.default {
2381
2419
  const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildWebhooks(guildId));
2382
2420
  return response.map((webhook) => transformers_1.Webhooks.webhookFromRaw(webhook));
2383
2421
  }
2422
+ /** https://docs.discord.com/developers/resources/lobby#create-or-join-lobby */
2423
+ async joinLobby(options) {
2424
+ const response = await this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.lobbies(), {
2425
+ json: {
2426
+ secret: options.secret,
2427
+ idle_timeout_seconds: options.idleTimeoutSeconds,
2428
+ lobby_metadata: options.lobbyMetadata,
2429
+ member_metadata: options.memberMetadata,
2430
+ },
2431
+ });
2432
+ return transformers_1.Lobbies.lobbyFromRaw(response);
2433
+ }
2384
2434
  /** https://discord.com/developers/docs/resources/channel#join-thread */
2385
2435
  joinThread(channelId) {
2386
2436
  this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.threadMembers(channelId));
@@ -2474,6 +2524,52 @@ class Client extends node_events_1.default {
2474
2524
  });
2475
2525
  return response.map((guildMember) => transformers_1.Guilds.guildMemberFromRaw(guildMember));
2476
2526
  }
2527
+ /** https://docs.discord.com/developers/resources/message#search-guild-messages */
2528
+ async searchGuildMessages(guildId, options) {
2529
+ const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildMessagesSearch(guildId), {
2530
+ query: {
2531
+ limit: options?.limit,
2532
+ offset: options?.offset,
2533
+ max_id: options?.maxId,
2534
+ min_id: options?.minId,
2535
+ slop: options?.slop,
2536
+ content: options?.content,
2537
+ channel_id: options?.channelId,
2538
+ author_type: options?.authorType,
2539
+ author_id: options?.authorId,
2540
+ mentions: options?.mentions,
2541
+ mentions_roles_id: options?.mentionsRolesId,
2542
+ mention_everyone: options?.mentionEveryone,
2543
+ replied_to_user_id: options?.repliedToUserId,
2544
+ replied_to_message_id: options?.repliedToMessageId,
2545
+ pinned: options?.pinned,
2546
+ has: options?.has,
2547
+ embed_type: options?.embedType,
2548
+ embed_provider: options?.embedProvider,
2549
+ link_hostname: options?.linkHostname,
2550
+ attachment_filename: options?.attachmentFilename,
2551
+ attachment_extension: options?.attachmentExtension,
2552
+ sort_by: options?.sortBy,
2553
+ sort_order: options?.sortOrder,
2554
+ include_nsfw: options?.includeNfsw,
2555
+ },
2556
+ });
2557
+ return {
2558
+ doingDeepHistoricalIndex: response.doing_deep_historical_index,
2559
+ documentsIndexed: response.documents_indexed,
2560
+ totalResults: response.total_results,
2561
+ messages: response.messages.map((message) => transformers_1.Messages.messageFromRaw(message)),
2562
+ threads: response.threads?.map((thread) => transformers_1.Channels.channelFromRaw(thread)),
2563
+ members: response.members?.map((member) => transformers_1.Channels.threadMemberFromRaw(member)),
2564
+ };
2565
+ }
2566
+ /** https://docs.discord.com/developers/resources/lobby#send-lobby-message */
2567
+ async sendLobbyMessage(lobbyId, options) {
2568
+ const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.lobbyMessages(lobbyId), {
2569
+ json: options,
2570
+ });
2571
+ return transformers_1.Lobbies.lobbyMessageFromRaw(response);
2572
+ }
2477
2573
  /** https://discord.com/developers/docs/resources/soundboard#send-soundboard-sound */
2478
2574
  sendSoundboardSound(channelId, options) {
2479
2575
  this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.sendSoundboardSound(channelId), {
@@ -2487,6 +2583,13 @@ class Client extends node_events_1.default {
2487
2583
  setPresence(options) {
2488
2584
  this.shards.forEach((shard) => shard.transmitter.updatePresence(options));
2489
2585
  }
2586
+ /** https://docs.discord.com/developers/resources/channel#set-voice-channel-status */
2587
+ setVoiceChannelStatus(channelId, options, reason) {
2588
+ this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.channelVoiceStatus(channelId), {
2589
+ json: options,
2590
+ reason,
2591
+ });
2592
+ }
2490
2593
  /** https://discord.com/developers/docs/resources/guild-template#sync-guild-template */
2491
2594
  async syncGuildTemplate(guildId, code) {
2492
2595
  const response = await this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.guildTemplate(guildId, code));
@@ -2529,6 +2632,12 @@ class Client extends node_events_1.default {
2529
2632
  files: [targetUsersFile],
2530
2633
  });
2531
2634
  }
2635
+ /** https://docs.discord.com/developers/resources/lobby#update-lobby-message-moderation-metadata */
2636
+ updateLobbyMessageModerationMetadata(lobbyId, messageId, metadata) {
2637
+ this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.lobbyMessageModerationMetadata(lobbyId, messageId), {
2638
+ json: metadata,
2639
+ });
2640
+ }
2532
2641
  /** https://discord.com/developers/docs/resources/channel#unpin-message */
2533
2642
  unpinMessage(channelId, messageId, reason) {
2534
2643
  this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.channelPin(channelId, messageId), {
@@ -138,7 +138,10 @@ export declare enum ComponentTypes {
138
138
  Separator = 14,
139
139
  Container = 17,
140
140
  Label = 18,
141
- FileUpload = 19
141
+ FileUpload = 19,
142
+ RadioGroup = 21,
143
+ CheckboxGroup = 22,
144
+ Checkbox = 23
142
145
  }
143
146
  /** https://discord.com/developers/docs/components/reference#button-button-styles */
144
147
  export declare enum ButtonStyles {
@@ -159,6 +162,10 @@ export declare enum SeparatorSpacing {
159
162
  Small = 1,
160
163
  Large = 2
161
164
  }
165
+ /** https://docs.discord.com/developers/components/reference#unfurled-media-item-unfurled-media-item-flags */
166
+ export declare enum UnfurledMediaItemFlags {
167
+ IsAnimated = 1
168
+ }
162
169
  /** https://discord.com/developers/docs/resources/application#application-object-application-integration-types */
163
170
  export declare enum ApplicationIntegrationTypes {
164
171
  GuildInstall = 0,
@@ -267,7 +274,9 @@ export declare enum AuditLogEvents {
267
274
  OnboardingCreate = 166,
268
275
  OnboardingUpdate = 167,
269
276
  HomeSettingsCreate = 190,
270
- HomeSettingsUpdate = 191
277
+ HomeSettingsUpdate = 191,
278
+ VoiceChannelStatusUpdate = 192,
279
+ VoiceChannelStatusDelete = 193
271
280
  }
272
281
  /** https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types */
273
282
  export declare enum TriggerTypes {
@@ -611,9 +620,21 @@ export declare enum EmbedTypes {
611
620
  Link = "link",
612
621
  PollResult = "poll_result"
613
622
  }
623
+ /** https://docs.discord.com/developers/resources/message#embed-object-embed-flags */
624
+ export declare enum EmbedFlags {
625
+ IsContentInventoryEntry = 32
626
+ }
627
+ /** https://docs.discord.com/developers/resources/message#embed-object-embed-media-flags */
628
+ export declare enum EmbedMediaFlags {
629
+ IsAnimated = 32
630
+ }
614
631
  /** https://discord.com/developers/docs/resources/message#attachment-object-attachment-flags */
615
632
  export declare enum AttachmentFlags {
616
- IsRemix = 4
633
+ IsClip = 1,
634
+ IsThumbnail = 2,
635
+ IsRemix = 4,
636
+ IsSpoiler = 8,
637
+ IsAnimated = 32
617
638
  }
618
639
  /** https://discord.com/developers/docs/resources/message#allowed-mentions-object-allowed-mention-types */
619
640
  export declare enum AllowedMentionTypes {
@@ -621,6 +642,45 @@ export declare enum AllowedMentionTypes {
621
642
  UserMentions = "users",
622
643
  EveryoneMentions = "everyone"
623
644
  }
645
+ /** https://docs.discord.com/developers/resources/message#base-theme-types */
646
+ export declare enum BaseThemeTypes {
647
+ Unset = 0,
648
+ Dark = 1,
649
+ Light = 2,
650
+ Darker = 3,
651
+ Midnight = 4
652
+ }
653
+ /** https://docs.discord.com/developers/resources/message#search-guild-messages-author-types */
654
+ export declare enum AuthorTypes {
655
+ User = "user",
656
+ Bot = "bot",
657
+ Webhook = "webhook"
658
+ }
659
+ /** https://docs.discord.com/developers/resources/message#search-guild-messages-search-has-types */
660
+ export declare enum SearchHasTypes {
661
+ Image = "image",
662
+ Sound = "sound",
663
+ Video = "video",
664
+ File = "file",
665
+ Sticker = "sticker",
666
+ Embed = "embed",
667
+ Link = "link",
668
+ Poll = "poll",
669
+ Snapshot = "snapshot"
670
+ }
671
+ /** https://docs.discord.com/developers/resources/message#search-guild-messages-search-embed-types */
672
+ export declare enum SearchEmbedTypes {
673
+ Image = "image",
674
+ Video = "video",
675
+ GIF = "gif",
676
+ Sound = "sound",
677
+ Article = "article"
678
+ }
679
+ /** https://docs.discord.com/developers/resources/message#search-guild-messages-search-sort-modes */
680
+ export declare enum SearchSortModes {
681
+ Timestamp = "timestamp",
682
+ Relevance = "relevance"
683
+ }
624
684
  /** https://discord.com/developers/docs/resources/message#get-reactions-reaction-types */
625
685
  export declare enum ReactionTypes {
626
686
  Normal = 0,
@@ -772,6 +832,7 @@ export declare enum GatewayEvents {
772
832
  ChannelCreate = "CHANNEL_CREATE",
773
833
  ChannelUpdate = "CHANNEL_UPDATE",
774
834
  ChannelDelete = "CHANNEL_DELETE",
835
+ ChannelInfo = "CHANNEL_INFO",
775
836
  ChannelPinsUpdate = "CHANNEL_PINS_UPDATE",
776
837
  ThreadCreate = "THREAD_CREATE",
777
838
  ThreadUpdate = "THREAD_UPDATE",
@@ -832,6 +893,8 @@ export declare enum GatewayEvents {
832
893
  TypingStart = "TYPING_START",
833
894
  UserUpdate = "USER_UPDATE",
834
895
  VoiceChannelEffectSend = "VOICE_CHANNEL_EFFECT_SEND",
896
+ VoiceChannelStartTimeUpdate = "VOICE_CHANNEL_START_TIME_UPDATE",
897
+ VoiceChannelStatusUpdate = "VOICE_CHANNEL_STATUS_UPDATE",
835
898
  VoiceStateUpdate = "VOICE_STATE_UPDATE",
836
899
  VoiceServerUpdate = "VOICE_SERVER_UPDATE",
837
900
  WebhooksUpdate = "WEBHOOKS_UPDATE",
@@ -884,6 +947,7 @@ export declare enum OAuth2Scopes {
884
947
  GuildsJoin = "guilds.join",
885
948
  GuildsMembersRead = "guilds.members.read",
886
949
  Identify = "identify",
950
+ IdentifyPremium = "identify.premium",
887
951
  MessagesRead = "messages.read",
888
952
  RelationShipsRead = "relationships.read",
889
953
  RoleConnectionsWrite = "role_connections.write",
@@ -908,7 +972,8 @@ export declare enum GatewayOPCodes {
908
972
  InvalidSession = 9,
909
973
  Hello = 10,
910
974
  HeartbeatACK = 11,
911
- RequestSoundboardSounds = 31
975
+ RequestSoundboardSounds = 31,
976
+ RequestChannelInfo = 43
912
977
  }
913
978
  /** https://discord.com/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes */
914
979
  export declare enum GatewayCloseEventCodes {
@@ -955,7 +1020,10 @@ export declare enum VoiceCloseEventCodes {
955
1020
  Disconnect = 4014,
956
1021
  VoiceServerCrashed = 4015,
957
1022
  UnknownEncryptionMode = 4016,
958
- BadRequest = 4020
1023
+ ProtocolRequired = 4017,
1024
+ BadRequest = 4020,
1025
+ RateLimited = 4021,
1026
+ CallTerminated = 4022
959
1027
  }
960
1028
  /** https://discord.com/developers/docs/topics/opcodes-and-status-codes#http-http-response-codes */
961
1029
  export declare enum HTTPResponseCodes {
@@ -1161,10 +1229,13 @@ export declare enum JSONErrorCodes {
1161
1229
  YouCannotSendVoiceMessagesInThisChannel = 50173,
1162
1230
  TheUserAccountMustFirstBeVerified = 50178,
1163
1231
  TheProvidedFileDoesNotHaveAValidDuration = 50192,
1232
+ CannotSendMessagesToThisUserDueToHavingNoMutualGuilds = 50278,
1164
1233
  YouDoNotHavePermissionToSendThisSticker = 50600,
1165
1234
  TwoFactorAuthenticationIsRequired = 60003,
1166
1235
  NoUsersWithDiscordTagExist = 80004,
1167
1236
  ReactionWasBlocked = 90001,
1237
+ UserCannotUseBurstReactions = 90002,
1238
+ IndexNotYetAvailable = 110000,
1168
1239
  ApplicationNotYetAvailable = 110001,
1169
1240
  APIResourceOverloaded = 130000,
1170
1241
  TheStageIsAlreadyOpen = 150006,
@@ -1173,6 +1244,7 @@ export declare enum JSONErrorCodes {
1173
1244
  ThreadLocked = 160005,
1174
1245
  MaximumActiveThreads = 160006,
1175
1246
  MaximumActiveAnnouncementThreads = 160007,
1247
+ YouCannotForwardAMessageWhoseContentYouCannotRead = 160014,
1176
1248
  InvalidJSONForUploadedLottieFile = 170001,
1177
1249
  UploadedLottiesCannotContainRasterizedImages = 170002,
1178
1250
  StickerMaximumFramerateExceeded = 170003,
@@ -1278,6 +1350,7 @@ export declare const BitwisePermissionFlags: {
1278
1350
  readonly CreateEvents: bigint;
1279
1351
  readonly UseExternalSounds: bigint;
1280
1352
  readonly SendVoiceMessages: bigint;
1353
+ readonly SetVoiceChannelStatus: bigint;
1281
1354
  readonly SendPolls: bigint;
1282
1355
  readonly UseExternalApps: bigint;
1283
1356
  readonly PinMessages: bigint;