disgroove 3.0.1-dev.739a5a9 → 3.0.1-dev.c03cf79
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/README.md +38 -8
- package/dist/lib/Client.d.ts +56 -3
- package/dist/lib/Client.js +71 -0
- package/dist/lib/constants.d.ts +78 -5
- package/dist/lib/constants.js +84 -2
- package/dist/lib/gateway/Dispatcher.d.ts +4 -1
- package/dist/lib/gateway/Dispatcher.js +24 -0
- package/dist/lib/gateway/Transmitter.d.ts +3 -1
- package/dist/lib/gateway/Transmitter.js +7 -0
- package/dist/lib/rest/Endpoints.d.ts +4 -0
- package/dist/lib/rest/Endpoints.js +11 -3
- package/dist/lib/transformers/Applications.js +2 -0
- package/dist/lib/transformers/AuditLogs.js +2 -0
- package/dist/lib/transformers/Components.d.ts +7 -1
- package/dist/lib/transformers/Components.js +80 -0
- package/dist/lib/transformers/Guilds.js +10 -0
- package/dist/lib/transformers/Interactions.js +46 -0
- package/dist/lib/transformers/Invites.d.ts +3 -0
- package/dist/lib/transformers/Invites.js +32 -0
- package/dist/lib/transformers/Messages.d.ts +1 -1
- package/dist/lib/transformers/Messages.js +78 -20
- package/dist/lib/transformers/Users.d.ts +3 -1
- package/dist/lib/transformers/Users.js +16 -10
- package/dist/lib/types/application.d.ts +4 -2
- package/dist/lib/types/audit-log.d.ts +2 -0
- package/dist/lib/types/components.d.ts +133 -7
- package/dist/lib/types/gateway-events.d.ts +61 -1
- package/dist/lib/types/guild.d.ts +3 -1
- package/dist/lib/types/invite.d.ts +2 -2
- package/dist/lib/types/message.d.ts +66 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,14 +1,42 @@
|
|
|
1
1
|
# disgroove
|
|
2
2
|
|
|
3
|
-
A
|
|
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
|
-
|
|
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
|
-
##
|
|
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(
|
|
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",
|
|
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!
|
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, 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,7 +26,7 @@ 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";
|
|
@@ -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 */
|
|
@@ -316,6 +323,7 @@ export declare class Client extends EventEmitter {
|
|
|
316
323
|
flags?: MessageFlags;
|
|
317
324
|
enforceNonce?: boolean;
|
|
318
325
|
poll?: PollCreateParams;
|
|
326
|
+
sharedClientTheme?: SharedClientTheme;
|
|
319
327
|
}): Promise<Message>;
|
|
320
328
|
/** https://discord.com/developers/docs/resources/message#create-reaction */
|
|
321
329
|
createMessageReaction(channelId: snowflake, messageId: snowflake, emoji: string): void;
|
|
@@ -376,6 +384,8 @@ export declare class Client extends EventEmitter {
|
|
|
376
384
|
deleteChannel(channelId: snowflake, reason?: string): Promise<Channel>;
|
|
377
385
|
/** https://discord.com/developers/docs/resources/channel#delete-channel-permission */
|
|
378
386
|
deleteChannelPermission(channelId: snowflake, overwriteId: snowflake, reason?: string): void;
|
|
387
|
+
/** https://docs.discord.com/developers/resources/user#delete-current-user-application-role-connection */
|
|
388
|
+
deleteCurrentUserApplicationRoleConnection(applicationId: snowflake): void;
|
|
379
389
|
/** https://discord.com/developers/docs/interactions/application-commands#delete-global-application-command */
|
|
380
390
|
deleteGlobalApplicationCommand(applicationId: snowflake, commandId: snowflake): void;
|
|
381
391
|
/** https://discord.com/developers/docs/interactions/application-commands#delete-guild-application-command */
|
|
@@ -1091,6 +1101,40 @@ export declare class Client extends EventEmitter {
|
|
|
1091
1101
|
query: string;
|
|
1092
1102
|
limit?: number;
|
|
1093
1103
|
}): Promise<Array<GuildMember>>;
|
|
1104
|
+
/** https://docs.discord.com/developers/resources/message#search-guild-messages */
|
|
1105
|
+
searchGuildMessages(guildId: snowflake, options?: {
|
|
1106
|
+
limit?: number;
|
|
1107
|
+
offset?: number;
|
|
1108
|
+
maxId?: snowflake;
|
|
1109
|
+
minId?: snowflake;
|
|
1110
|
+
slop?: number;
|
|
1111
|
+
content?: string;
|
|
1112
|
+
channelId?: snowflake;
|
|
1113
|
+
authorType?: Array<AuthorTypes>;
|
|
1114
|
+
authorId?: Array<snowflake>;
|
|
1115
|
+
mentions?: Array<snowflake>;
|
|
1116
|
+
mentionsRolesId?: Array<snowflake>;
|
|
1117
|
+
mentionEveryone?: boolean;
|
|
1118
|
+
repliedToUserId?: Array<snowflake>;
|
|
1119
|
+
repliedToMessageId?: Array<snowflake>;
|
|
1120
|
+
pinned?: boolean;
|
|
1121
|
+
has?: Array<SearchHasTypes>;
|
|
1122
|
+
embedType?: Array<SearchEmbedTypes>;
|
|
1123
|
+
embedProvider?: Array<string>;
|
|
1124
|
+
linkHostname?: Array<string>;
|
|
1125
|
+
attachmentFilename?: Array<string>;
|
|
1126
|
+
attachmentExtension?: Array<string>;
|
|
1127
|
+
sortBy?: SearchSortModes;
|
|
1128
|
+
sortOrder?: string;
|
|
1129
|
+
includeNfsw?: boolean;
|
|
1130
|
+
}): Promise<{
|
|
1131
|
+
doingDeepHistoricalIndex: boolean;
|
|
1132
|
+
documentsIndexed?: number;
|
|
1133
|
+
totalResults: number;
|
|
1134
|
+
messages: Array<Message>;
|
|
1135
|
+
threads?: Array<Channel>;
|
|
1136
|
+
members?: Array<ThreadMember>;
|
|
1137
|
+
}>;
|
|
1094
1138
|
/** https://discord.com/developers/docs/resources/soundboard#send-soundboard-sound */
|
|
1095
1139
|
sendSoundboardSound(channelId: snowflake, options: {
|
|
1096
1140
|
soundId: snowflake;
|
|
@@ -1098,6 +1142,10 @@ export declare class Client extends EventEmitter {
|
|
|
1098
1142
|
}): void;
|
|
1099
1143
|
/** https://discord.com/developers/docs/topics/gateway-events#update-presence */
|
|
1100
1144
|
setPresence(options: Partial<Pick<GatewayPresenceUpdate, "activities" | "status" | "afk">>): void;
|
|
1145
|
+
/** https://docs.discord.com/developers/resources/channel#set-voice-channel-status */
|
|
1146
|
+
setVoiceChannelStatus(channelId: snowflake, options: {
|
|
1147
|
+
status: string | null;
|
|
1148
|
+
}, reason?: string): void;
|
|
1101
1149
|
/** https://discord.com/developers/docs/resources/guild-template#sync-guild-template */
|
|
1102
1150
|
syncGuildTemplate(guildId: snowflake, code: string): Promise<GuildTemplate>;
|
|
1103
1151
|
/** https://discord.com/developers/docs/resources/channel#trigger-typing-indicator */
|
|
@@ -1114,6 +1162,8 @@ export declare class Client extends EventEmitter {
|
|
|
1114
1162
|
}): Promise<ApplicationRoleConnection>;
|
|
1115
1163
|
/** https://discord.com/developers/docs/resources/invite#update-target-users */
|
|
1116
1164
|
updateInviteTargetUser(inviteCode: string, targetUsersFile: FileData): void;
|
|
1165
|
+
/** https://docs.discord.com/developers/resources/lobby#update-lobby-message-moderation-metadata */
|
|
1166
|
+
updateLobbyMessageModerationMetadata(lobbyId: snowflake, messageId: snowflake, metadata: Record<string, string>): void;
|
|
1117
1167
|
/** https://discord.com/developers/docs/resources/channel#unpin-message */
|
|
1118
1168
|
unpinMessage(channelId: snowflake, messageId: snowflake, reason?: string): void;
|
|
1119
1169
|
}
|
|
@@ -1153,6 +1203,7 @@ export interface ClientEvents {
|
|
|
1153
1203
|
channelCreate: [channel: Channel];
|
|
1154
1204
|
channelUpdate: [channel: Channel];
|
|
1155
1205
|
channelDelete: [channel: Channel];
|
|
1206
|
+
channelInfo: [info: ChannelInfoEvent];
|
|
1156
1207
|
channelPinsUpdate: [pins: ChannelPinsUpdateEvent];
|
|
1157
1208
|
threadCreate: [thread: Channel];
|
|
1158
1209
|
threadUpdate: [thread: Channel];
|
|
@@ -1228,6 +1279,8 @@ export interface ClientEvents {
|
|
|
1228
1279
|
typingStart: [typing: TypingStartEvent];
|
|
1229
1280
|
userUpdate: [user: User];
|
|
1230
1281
|
voiceChannelEffectSend: [voiceEffect: VoiceChannelEffectSendEvent];
|
|
1282
|
+
voiceChannelStatusUpdate: [voiceChannel: VoiceChannelStatusUpdateEvent];
|
|
1283
|
+
voiceChannelStartTimeUpdate: [voiceChannel: VoiceChannelStartTimeUpdateEvent];
|
|
1231
1284
|
voiceStateUpdate: [voiceState: VoiceState];
|
|
1232
1285
|
voiceServerUpdate: [voiceServer: VoiceServerUpdateEvent];
|
|
1233
1286
|
webhooksUpdate: [channelId: snowflake, guildId: snowflake];
|
package/dist/lib/Client.js
CHANGED
|
@@ -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 =
|
|
@@ -652,6 +659,14 @@ class Client extends node_events_1.default {
|
|
|
652
659
|
layout_type: options.poll.layoutType,
|
|
653
660
|
}
|
|
654
661
|
: undefined,
|
|
662
|
+
shared_client_theme: options.sharedClientTheme !== undefined
|
|
663
|
+
? {
|
|
664
|
+
colors: options.sharedClientTheme.colors,
|
|
665
|
+
gradient_angle: options.sharedClientTheme.gradientAngle,
|
|
666
|
+
base_mix: options.sharedClientTheme.baseMix,
|
|
667
|
+
base_theme: options.sharedClientTheme.baseTheme,
|
|
668
|
+
}
|
|
669
|
+
: undefined,
|
|
655
670
|
},
|
|
656
671
|
files: options.files,
|
|
657
672
|
});
|
|
@@ -773,6 +788,10 @@ class Client extends node_events_1.default {
|
|
|
773
788
|
reason,
|
|
774
789
|
});
|
|
775
790
|
}
|
|
791
|
+
/** https://docs.discord.com/developers/resources/user#delete-current-user-application-role-connection */
|
|
792
|
+
deleteCurrentUserApplicationRoleConnection(applicationId) {
|
|
793
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.userApplicationRoleConnection(applicationId));
|
|
794
|
+
}
|
|
776
795
|
/** https://discord.com/developers/docs/interactions/application-commands#delete-global-application-command */
|
|
777
796
|
deleteGlobalApplicationCommand(applicationId, commandId) {
|
|
778
797
|
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.applicationCommand(applicationId, commandId));
|
|
@@ -2474,6 +2493,45 @@ class Client extends node_events_1.default {
|
|
|
2474
2493
|
});
|
|
2475
2494
|
return response.map((guildMember) => transformers_1.Guilds.guildMemberFromRaw(guildMember));
|
|
2476
2495
|
}
|
|
2496
|
+
/** https://docs.discord.com/developers/resources/message#search-guild-messages */
|
|
2497
|
+
async searchGuildMessages(guildId, options) {
|
|
2498
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildMessagesSearch(guildId), {
|
|
2499
|
+
query: {
|
|
2500
|
+
limit: options?.limit,
|
|
2501
|
+
offset: options?.offset,
|
|
2502
|
+
max_id: options?.maxId,
|
|
2503
|
+
min_id: options?.minId,
|
|
2504
|
+
slop: options?.slop,
|
|
2505
|
+
content: options?.content,
|
|
2506
|
+
channel_id: options?.channelId,
|
|
2507
|
+
author_type: options?.authorType,
|
|
2508
|
+
author_id: options?.authorId,
|
|
2509
|
+
mentions: options?.mentions,
|
|
2510
|
+
mentions_roles_id: options?.mentionsRolesId,
|
|
2511
|
+
mention_everyone: options?.mentionEveryone,
|
|
2512
|
+
replied_to_user_id: options?.repliedToUserId,
|
|
2513
|
+
replied_to_message_id: options?.repliedToMessageId,
|
|
2514
|
+
pinned: options?.pinned,
|
|
2515
|
+
has: options?.has,
|
|
2516
|
+
embed_type: options?.embedType,
|
|
2517
|
+
embed_provider: options?.embedProvider,
|
|
2518
|
+
link_hostname: options?.linkHostname,
|
|
2519
|
+
attachment_filename: options?.attachmentFilename,
|
|
2520
|
+
attachment_extension: options?.attachmentExtension,
|
|
2521
|
+
sort_by: options?.sortBy,
|
|
2522
|
+
sort_order: options?.sortOrder,
|
|
2523
|
+
include_nsfw: options?.includeNfsw,
|
|
2524
|
+
},
|
|
2525
|
+
});
|
|
2526
|
+
return {
|
|
2527
|
+
doingDeepHistoricalIndex: response.doing_deep_historical_index,
|
|
2528
|
+
documentsIndexed: response.documents_indexed,
|
|
2529
|
+
totalResults: response.total_results,
|
|
2530
|
+
messages: response.messages.map((message) => transformers_1.Messages.messageFromRaw(message)),
|
|
2531
|
+
threads: response.threads?.map((thread) => transformers_1.Channels.channelFromRaw(thread)),
|
|
2532
|
+
members: response.members?.map((member) => transformers_1.Channels.threadMemberFromRaw(member)),
|
|
2533
|
+
};
|
|
2534
|
+
}
|
|
2477
2535
|
/** https://discord.com/developers/docs/resources/soundboard#send-soundboard-sound */
|
|
2478
2536
|
sendSoundboardSound(channelId, options) {
|
|
2479
2537
|
this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.sendSoundboardSound(channelId), {
|
|
@@ -2487,6 +2545,13 @@ class Client extends node_events_1.default {
|
|
|
2487
2545
|
setPresence(options) {
|
|
2488
2546
|
this.shards.forEach((shard) => shard.transmitter.updatePresence(options));
|
|
2489
2547
|
}
|
|
2548
|
+
/** https://docs.discord.com/developers/resources/channel#set-voice-channel-status */
|
|
2549
|
+
setVoiceChannelStatus(channelId, options, reason) {
|
|
2550
|
+
this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.channelVoiceStatus(channelId), {
|
|
2551
|
+
json: options,
|
|
2552
|
+
reason,
|
|
2553
|
+
});
|
|
2554
|
+
}
|
|
2490
2555
|
/** https://discord.com/developers/docs/resources/guild-template#sync-guild-template */
|
|
2491
2556
|
async syncGuildTemplate(guildId, code) {
|
|
2492
2557
|
const response = await this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.guildTemplate(guildId, code));
|
|
@@ -2529,6 +2594,12 @@ class Client extends node_events_1.default {
|
|
|
2529
2594
|
files: [targetUsersFile],
|
|
2530
2595
|
});
|
|
2531
2596
|
}
|
|
2597
|
+
/** https://docs.discord.com/developers/resources/lobby#update-lobby-message-moderation-metadata */
|
|
2598
|
+
updateLobbyMessageModerationMetadata(lobbyId, messageId, metadata) {
|
|
2599
|
+
this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.lobbyMessageModerationMetadata(lobbyId, messageId), {
|
|
2600
|
+
json: metadata,
|
|
2601
|
+
});
|
|
2602
|
+
}
|
|
2532
2603
|
/** https://discord.com/developers/docs/resources/channel#unpin-message */
|
|
2533
2604
|
unpinMessage(channelId, messageId, reason) {
|
|
2534
2605
|
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.channelPin(channelId, messageId), {
|
package/dist/lib/constants.d.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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;
|