seyfert 2.0.0 → 2.1.1-dev-11310514874.0
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/lib/api/Router.d.ts +2 -2
- package/lib/api/Router.js +2 -1
- package/lib/api/Routes/applications.d.ts +29 -30
- package/lib/api/Routes/cdn.d.ts +6 -1
- package/lib/api/Routes/channels.d.ts +44 -45
- package/lib/api/Routes/gateway.d.ts +3 -4
- package/lib/api/Routes/guilds.d.ts +81 -80
- package/lib/api/Routes/index.d.ts +3 -1
- package/lib/api/Routes/interactions.d.ts +9 -3
- package/lib/api/Routes/invites.d.ts +3 -4
- package/lib/api/Routes/skus.d.ts +10 -0
- package/lib/api/Routes/skus.js +2 -0
- package/lib/api/Routes/soundboard.d.ts +23 -0
- package/lib/api/Routes/soundboard.js +2 -0
- package/lib/api/Routes/stage-instances.d.ts +5 -6
- package/lib/api/Routes/stickers.d.ts +3 -4
- package/lib/api/Routes/users.d.ts +11 -12
- package/lib/api/Routes/voice.d.ts +2 -3
- package/lib/api/Routes/webhooks.d.ts +16 -15
- package/lib/api/api.d.ts +17 -11
- package/lib/api/api.js +26 -22
- package/lib/api/shared.d.ts +2 -2
- package/lib/api/utils/constants.d.ts +3 -1
- package/lib/api/utils/constants.js +3 -2
- package/lib/builders/ActionRow.d.ts +1 -1
- package/lib/builders/Attachment.d.ts +3 -3
- package/lib/builders/Attachment.js +13 -13
- package/lib/builders/Button.d.ts +1 -1
- package/lib/builders/Button.js +1 -1
- package/lib/builders/Embed.d.ts +1 -1
- package/lib/builders/Embed.js +2 -2
- package/lib/builders/Modal.d.ts +1 -1
- package/lib/builders/Poll.d.ts +1 -1
- package/lib/builders/Poll.js +1 -1
- package/lib/builders/SelectMenu.d.ts +1 -1
- package/lib/builders/SelectMenu.js +1 -1
- package/lib/builders/types.d.ts +2 -1
- package/lib/cache/adapters/default.js +5 -3
- package/lib/cache/adapters/limited.d.ts +1 -2
- package/lib/cache/adapters/limited.js +34 -30
- package/lib/cache/adapters/workeradapter.js +3 -1
- package/lib/cache/index.d.ts +12 -12
- package/lib/cache/index.js +48 -39
- package/lib/cache/resources/bans.d.ts +2 -2
- package/lib/cache/resources/bans.js +1 -1
- package/lib/cache/resources/channels.d.ts +1 -1
- package/lib/cache/resources/default/guild-related.d.ts +1 -2
- package/lib/cache/resources/emojis.d.ts +2 -2
- package/lib/cache/resources/emojis.js +1 -1
- package/lib/cache/resources/guilds.d.ts +2 -2
- package/lib/cache/resources/guilds.js +7 -11
- package/lib/cache/resources/members.d.ts +2 -2
- package/lib/cache/resources/members.js +1 -1
- package/lib/cache/resources/messages.d.ts +2 -2
- package/lib/cache/resources/messages.js +3 -3
- package/lib/cache/resources/overwrites.d.ts +1 -1
- package/lib/cache/resources/roles.d.ts +2 -2
- package/lib/cache/resources/roles.js +1 -1
- package/lib/cache/resources/stickers.d.ts +2 -2
- package/lib/cache/resources/stickers.js +1 -1
- package/lib/cache/resources/users.d.ts +2 -2
- package/lib/cache/resources/users.js +1 -1
- package/lib/cache/resources/voice-states.d.ts +2 -2
- package/lib/cache/resources/voice-states.js +1 -1
- package/lib/client/base.d.ts +10 -15
- package/lib/client/base.js +48 -44
- package/lib/client/client.d.ts +4 -4
- package/lib/client/client.js +37 -38
- package/lib/client/collectors.js +1 -1
- package/lib/client/httpclient.d.ts +1 -1
- package/lib/client/httpclient.js +2 -2
- package/lib/client/transformers.d.ts +37 -34
- package/lib/client/transformers.js +66 -63
- package/lib/client/workerclient.d.ts +13 -13
- package/lib/client/workerclient.js +182 -65
- package/lib/collection.d.ts +3 -3
- package/lib/commands/applications/chat.d.ts +3 -3
- package/lib/commands/applications/chat.js +5 -6
- package/lib/commands/applications/chatcontext.d.ts +6 -6
- package/lib/commands/applications/chatcontext.js +16 -8
- package/lib/commands/applications/entryPoint.d.ts +46 -0
- package/lib/commands/applications/entryPoint.js +56 -0
- package/lib/commands/applications/entrycontext.d.ts +40 -0
- package/lib/commands/applications/entrycontext.js +85 -0
- package/lib/commands/applications/menu.d.ts +1 -1
- package/lib/commands/applications/menucontext.d.ts +5 -5
- package/lib/commands/applications/menucontext.js +6 -6
- package/lib/commands/applications/options.d.ts +7 -6
- package/lib/commands/applications/shared.d.ts +5 -2
- package/lib/commands/basecontext.d.ts +1 -1
- package/lib/commands/decorators.d.ts +20 -26
- package/lib/commands/decorators.js +8 -4
- package/lib/commands/handle.d.ts +13 -12
- package/lib/commands/handle.js +133 -65
- package/lib/commands/handler.d.ts +9 -7
- package/lib/commands/handler.js +27 -18
- package/lib/commands/index.d.ts +2 -0
- package/lib/commands/index.js +2 -0
- package/lib/commands/optionresolver.d.ts +4 -4
- package/lib/commands/optionresolver.js +4 -4
- package/lib/common/bot/watcher.d.ts +1 -1
- package/lib/common/it/formatter.d.ts +21 -21
- package/lib/common/it/formatter.js +40 -41
- package/lib/common/it/logger.js +1 -1
- package/lib/common/it/utils.d.ts +14 -6
- package/lib/common/it/utils.js +62 -27
- package/lib/common/shorters/application.d.ts +2 -3
- package/lib/common/shorters/application.js +3 -3
- package/lib/common/shorters/bans.js +1 -1
- package/lib/common/shorters/channels.d.ts +3 -3
- package/lib/common/shorters/channels.js +3 -3
- package/lib/common/shorters/emojis.js +4 -4
- package/lib/common/shorters/guilds.d.ts +3 -3
- package/lib/common/shorters/guilds.js +5 -9
- package/lib/common/shorters/interaction.d.ts +3 -3
- package/lib/common/shorters/interaction.js +6 -5
- package/lib/common/shorters/members.d.ts +4 -5
- package/lib/common/shorters/members.js +6 -7
- package/lib/common/shorters/messages.d.ts +1 -1
- package/lib/common/shorters/messages.js +4 -4
- package/lib/common/shorters/reactions.d.ts +1 -1
- package/lib/common/shorters/reactions.js +1 -1
- package/lib/common/shorters/roles.js +1 -1
- package/lib/common/shorters/templates.js +2 -2
- package/lib/common/shorters/threads.d.ts +1 -1
- package/lib/common/shorters/threads.js +17 -11
- package/lib/common/shorters/webhook.d.ts +1 -1
- package/lib/common/shorters/webhook.js +4 -4
- package/lib/common/types/options.d.ts +2 -2
- package/lib/common/types/resolvables.d.ts +1 -1
- package/lib/common/types/util.d.ts +4 -1
- package/lib/common/types/write.d.ts +3 -3
- package/lib/components/BaseComponent.js +1 -1
- package/lib/components/ButtonComponent.d.ts +1 -1
- package/lib/components/componentcommand.d.ts +1 -1
- package/lib/components/componentcontext.d.ts +4 -4
- package/lib/components/componentcontext.js +1 -1
- package/lib/components/handler.d.ts +10 -8
- package/lib/components/handler.js +16 -13
- package/lib/components/index.js +2 -1
- package/lib/components/modalcontext.d.ts +2 -2
- package/lib/components/modalcontext.js +1 -1
- package/lib/deps/mixer.d.ts +1 -1
- package/lib/deps/mixer.js +6 -1
- package/lib/events/handler.d.ts +5 -5
- package/lib/events/handler.js +69 -19
- package/lib/events/hooks/application_command.d.ts +1 -1
- package/lib/events/hooks/auto_moderation.d.ts +1 -1
- package/lib/events/hooks/auto_moderation.js +1 -1
- package/lib/events/hooks/channel.d.ts +1 -1
- package/lib/events/hooks/custom.d.ts +1 -0
- package/lib/events/hooks/custom.js +5 -1
- package/lib/events/hooks/dispatch.d.ts +1 -1
- package/lib/events/hooks/entitlement.d.ts +4 -5
- package/lib/events/hooks/entitlement.js +4 -4
- package/lib/events/hooks/guild.d.ts +3 -3
- package/lib/events/hooks/guild.js +1 -1
- package/lib/events/hooks/index.d.ts +1 -0
- package/lib/events/hooks/index.js +1 -0
- package/lib/events/hooks/integration.d.ts +1 -1
- package/lib/events/hooks/integration.js +1 -1
- package/lib/events/hooks/interactions.d.ts +3 -3
- package/lib/events/hooks/invite.d.ts +1 -1
- package/lib/events/hooks/message.d.ts +3 -3
- package/lib/events/hooks/message.js +1 -1
- package/lib/events/hooks/presence.d.ts +2 -2
- package/lib/events/hooks/soundboard.d.ts +155 -0
- package/lib/events/hooks/soundboard.js +28 -0
- package/lib/events/hooks/stage.d.ts +2 -2
- package/lib/events/hooks/subscriptions.d.ts +35 -0
- package/lib/events/hooks/subscriptions.js +16 -0
- package/lib/events/hooks/thread.d.ts +2 -2
- package/lib/events/hooks/thread.js +2 -2
- package/lib/events/hooks/typing.d.ts +1 -1
- package/lib/events/hooks/typing.js +1 -1
- package/lib/events/hooks/user.d.ts +2 -2
- package/lib/events/hooks/voice.d.ts +2 -2
- package/lib/events/hooks/voice.js +1 -1
- package/lib/events/hooks/webhook.d.ts +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +3 -5
- package/lib/langs/handler.d.ts +2 -2
- package/lib/structures/Guild.d.ts +7 -4
- package/lib/structures/Guild.js +1 -1
- package/lib/structures/GuildBan.d.ts +1 -1
- package/lib/structures/GuildMember.d.ts +7 -5
- package/lib/structures/GuildMember.js +5 -3
- package/lib/structures/GuildRole.d.ts +1 -1
- package/lib/structures/GuildTemplate.d.ts +1 -1
- package/lib/structures/Interaction.d.ts +39 -16
- package/lib/structures/Interaction.js +82 -26
- package/lib/structures/Message.d.ts +4 -10
- package/lib/structures/Message.js +5 -8
- package/lib/structures/Poll.d.ts +3 -3
- package/lib/structures/Sticker.d.ts +2 -2
- package/lib/structures/Sticker.js +1 -1
- package/lib/structures/VoiceState.d.ts +2 -1
- package/lib/structures/VoiceState.js +1 -1
- package/lib/structures/Webhook.d.ts +3 -3
- package/lib/structures/Webhook.js +1 -1
- package/lib/structures/channels.d.ts +4 -4
- package/lib/structures/channels.js +8 -7
- package/lib/structures/extra/BaseGuild.d.ts +11 -1
- package/lib/structures/extra/BaseGuild.js +27 -0
- package/lib/structures/extra/BitField.d.ts +3 -3
- package/lib/structures/extra/BitField.js +34 -33
- package/lib/structures/extra/DiscordBase.js +1 -1
- package/lib/structures/extra/Permissions.d.ts +2 -0
- package/lib/structures/extra/Permissions.js +21 -0
- package/lib/types/gateway.d.ts +71 -6
- package/lib/types/payloads/_interactions/_applicationCommands/chatInput.d.ts +6 -1
- package/lib/types/payloads/_interactions/applicationCommands.d.ts +41 -6
- package/lib/types/payloads/_interactions/applicationCommands.js +28 -1
- package/lib/types/payloads/_interactions/base.d.ts +1 -1
- package/lib/types/payloads/_interactions/responses.d.ts +74 -2
- package/lib/types/payloads/_interactions/responses.js +4 -0
- package/lib/types/payloads/channel.d.ts +46 -6
- package/lib/types/payloads/channel.js +5 -1
- package/lib/types/payloads/guild.d.ts +9 -1
- package/lib/types/payloads/guild.js +8 -0
- package/lib/types/payloads/index.d.ts +1 -0
- package/lib/types/payloads/index.js +1 -0
- package/lib/types/payloads/monetization.d.ts +29 -1
- package/lib/types/payloads/monetization.js +10 -1
- package/lib/types/payloads/soundboard.d.ts +23 -0
- package/lib/types/payloads/soundboard.js +5 -0
- package/lib/types/payloads/user.js +0 -1
- package/lib/types/rest/application.d.ts +3 -3
- package/lib/types/rest/auditLog.d.ts +1 -1
- package/lib/types/rest/channel.d.ts +5 -18
- package/lib/types/rest/guild.d.ts +2 -2
- package/lib/types/rest/guildScheduledEvent.d.ts +1 -1
- package/lib/types/rest/index.d.ts +1 -0
- package/lib/types/rest/index.js +1 -0
- package/lib/types/rest/interactions.d.ts +30 -8
- package/lib/types/rest/monetization.d.ts +22 -1
- package/lib/types/rest/oauth2.d.ts +1 -1
- package/lib/types/rest/poll.d.ts +1 -1
- package/lib/types/rest/soundboard.d.ts +64 -0
- package/lib/types/rest/soundboard.js +2 -0
- package/lib/types/rest/stageInstance.d.ts +1 -1
- package/lib/types/rest/template.d.ts +1 -1
- package/lib/types/rest/user.d.ts +1 -1
- package/lib/types/rest/webhook.d.ts +3 -3
- package/lib/types/utils/index.d.ts +27 -7
- package/lib/types/utils/index.js +25 -6
- package/lib/websocket/SharedTypes.d.ts +18 -3
- package/lib/websocket/constants/index.d.ts +3 -2
- package/lib/websocket/constants/index.js +4 -4
- package/lib/websocket/discord/basesocket.d.ts +1 -1
- package/lib/websocket/discord/shard.d.ts +4 -3
- package/lib/websocket/discord/shard.js +47 -24
- package/lib/websocket/discord/sharder.d.ts +9 -6
- package/lib/websocket/discord/sharder.js +92 -17
- package/lib/websocket/discord/shared.d.ts +12 -3
- package/lib/websocket/discord/socket/custom.d.ts +1 -1
- package/lib/websocket/discord/socket/custom.js +70 -40
- package/lib/websocket/discord/worker.d.ts +9 -2
- package/lib/websocket/discord/workermanager.d.ts +42 -16
- package/lib/websocket/discord/workermanager.js +170 -46
- package/lib/websocket/structures/timeout.d.ts +4 -5
- package/lib/websocket/structures/timeout.js +23 -24
- package/package.json +72 -65
- package/lib/cache/resources/threads.d.ts +0 -14
- package/lib/cache/resources/threads.js +0 -32
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Snowflake } from '..';
|
|
2
|
-
import type {
|
|
2
|
+
import type { APIActionRowComponent, APIAllowedMentions, APIEmbed, APIMessage, APIMessageActionRowComponent, APIWebhook, MessageFlags } from '../payloads';
|
|
3
3
|
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, Nullable } from '../utils';
|
|
4
4
|
import type { RESTAPIAttachment } from './channel';
|
|
5
5
|
import type { RESTAPIPollCreate } from './poll';
|
|
@@ -221,13 +221,13 @@ export interface RESTGetAPIWebhookWithTokenMessageQuery {
|
|
|
221
221
|
/**
|
|
222
222
|
* https://discord.com/developers/docs/resources/webhook#edit-webhook-message
|
|
223
223
|
*/
|
|
224
|
-
export type RESTPatchAPIWebhookWithTokenMessageJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<Nullable<Pick<RESTPostAPIWebhookWithTokenJSONBody, 'allowed_mentions' | 'components' | 'content' | 'embeds'>>> & {
|
|
224
|
+
export type RESTPatchAPIWebhookWithTokenMessageJSONBody = AddUndefinedToPossiblyUndefinedPropertiesOfInterface<Nullable<Pick<RESTPostAPIWebhookWithTokenJSONBody, 'allowed_mentions' | 'components' | 'content' | 'embeds' | 'poll'>>> & {
|
|
225
225
|
/**
|
|
226
226
|
* Attached files to keep
|
|
227
227
|
*
|
|
228
228
|
* Starting with API v10, the `attachments` array must contain all attachments that should be present after edit, including **retained and new** attachments provided in the request body.
|
|
229
229
|
*
|
|
230
|
-
* See https://discord.com/developers/docs/resources/
|
|
230
|
+
* See https://discord.com/developers/docs/resources/message#attachment-object
|
|
231
231
|
*/
|
|
232
232
|
attachments?: RESTAPIAttachment[] | undefined;
|
|
233
233
|
};
|
|
@@ -167,7 +167,11 @@ export declare enum GatewayOpcodes {
|
|
|
167
167
|
/**
|
|
168
168
|
* Sent in response to receiving a heartbeat to acknowledge that it has been received
|
|
169
169
|
*/
|
|
170
|
-
HeartbeatAck = 11
|
|
170
|
+
HeartbeatAck = 11,
|
|
171
|
+
/**
|
|
172
|
+
* Used to request soundboard sounds for a list of guilds. The server will send Soundboard Sounds events for each guild in response.
|
|
173
|
+
*/
|
|
174
|
+
RequestSoundboardSounds = 31
|
|
171
175
|
}
|
|
172
176
|
/**
|
|
173
177
|
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes
|
|
@@ -262,7 +266,7 @@ export declare enum GatewayIntentBits {
|
|
|
262
266
|
* @deprecated This is the old name for {@apilink GatewayIntentBits#GuildModeration}
|
|
263
267
|
*/
|
|
264
268
|
GuildBans = 4,
|
|
265
|
-
|
|
269
|
+
GuildExpressions = 8,
|
|
266
270
|
GuildIntegrations = 16,
|
|
267
271
|
GuildWebhooks = 32,
|
|
268
272
|
GuildInvites = 64,
|
|
@@ -323,6 +327,9 @@ export declare enum GatewayDispatchEvents {
|
|
|
323
327
|
StageInstanceCreate = "STAGE_INSTANCE_CREATE",
|
|
324
328
|
StageInstanceDelete = "STAGE_INSTANCE_DELETE",
|
|
325
329
|
StageInstanceUpdate = "STAGE_INSTANCE_UPDATE",
|
|
330
|
+
SubscriptionCreate = "SUBSCRIPTION_CREATE",
|
|
331
|
+
SubscriptionUpdate = "SUBSCRIPTION_UPDATE",
|
|
332
|
+
SubscriptionDelete = "SUBSCRIPTION_DELETE",
|
|
326
333
|
Ready = "READY",
|
|
327
334
|
Resumed = "RESUMED",
|
|
328
335
|
ThreadCreate = "THREAD_CREATE",
|
|
@@ -344,6 +351,11 @@ export declare enum GatewayDispatchEvents {
|
|
|
344
351
|
GuildScheduledEventDelete = "GUILD_SCHEDULED_EVENT_DELETE",
|
|
345
352
|
GuildScheduledEventUserAdd = "GUILD_SCHEDULED_EVENT_USER_ADD",
|
|
346
353
|
GuildScheduledEventUserRemove = "GUILD_SCHEDULED_EVENT_USER_REMOVE",
|
|
354
|
+
GuildSoundboardSoundCreate = "GUILD_SOUNDBOARD_SOUND_CREATE",
|
|
355
|
+
GuildSoundboardSoundUpdate = "GUILD_SOUNDBOARD_SOUND_UPDATE",
|
|
356
|
+
GuildSoundboardSoundDelete = "GUILD_SOUNDBOARD_SOUND_DELETE",
|
|
357
|
+
GuildSoundboardSoundsUpdate = "GUILD_SOUNDBOARD_SOUNDS_UPDATE",
|
|
358
|
+
SoundboardSounds = "SOUNDBOARD_SOUNDS",
|
|
347
359
|
AutoModerationRuleCreate = "AUTO_MODERATION_RULE_CREATE",
|
|
348
360
|
AutoModerationRuleUpdate = "AUTO_MODERATION_RULE_UPDATE",
|
|
349
361
|
AutoModerationRuleDelete = "AUTO_MODERATION_RULE_DELETE",
|
|
@@ -765,21 +777,29 @@ export declare enum GuildMemberFlags {
|
|
|
765
777
|
*/
|
|
766
778
|
StartedOnboarding = 8,
|
|
767
779
|
/**
|
|
768
|
-
*
|
|
780
|
+
* Member is a guest and can only access the voice channel they were invited to
|
|
781
|
+
*/
|
|
782
|
+
IsGuest = 16,
|
|
783
|
+
/**
|
|
784
|
+
* This guild member flag is currently not documented by Discord but has a known value which we will try to keep up to date.
|
|
769
785
|
*/
|
|
770
786
|
StartedHomeActions = 32,
|
|
771
787
|
/**
|
|
772
|
-
*
|
|
788
|
+
* This guild member flag is currently not documented by Discord but has a known value which we will try to keep up to date.
|
|
773
789
|
*/
|
|
774
790
|
CompletedHomeActions = 64,
|
|
775
791
|
/**
|
|
776
|
-
*
|
|
792
|
+
* This guild member flag is currently not documented by Discord but has a known value which we will try to keep up to date.
|
|
777
793
|
*/
|
|
778
794
|
AutomodQuarantinedUsernameOrGuildNickname = 128,
|
|
779
795
|
/**
|
|
780
|
-
* @
|
|
796
|
+
* @deprecated This guild member flag is currently not documented by Discord but has a known value which we will try to keep up to date.
|
|
797
|
+
*/
|
|
798
|
+
AutomodQuarantinedBio = 256,
|
|
799
|
+
/**
|
|
800
|
+
* Member has dismissed the DM settings upsell
|
|
781
801
|
*/
|
|
782
|
-
|
|
802
|
+
DmSettingsUpsellAcknowledged = 512
|
|
783
803
|
}
|
|
784
804
|
export declare enum OverwriteType {
|
|
785
805
|
Role = 0,
|
package/lib/types/utils/index.js
CHANGED
|
@@ -153,6 +153,10 @@ var GatewayOpcodes;
|
|
|
153
153
|
* Sent in response to receiving a heartbeat to acknowledge that it has been received
|
|
154
154
|
*/
|
|
155
155
|
GatewayOpcodes[GatewayOpcodes["HeartbeatAck"] = 11] = "HeartbeatAck";
|
|
156
|
+
/**
|
|
157
|
+
* Used to request soundboard sounds for a list of guilds. The server will send Soundboard Sounds events for each guild in response.
|
|
158
|
+
*/
|
|
159
|
+
GatewayOpcodes[GatewayOpcodes["RequestSoundboardSounds"] = 31] = "RequestSoundboardSounds";
|
|
156
160
|
})(GatewayOpcodes || (exports.GatewayOpcodes = GatewayOpcodes = {}));
|
|
157
161
|
/**
|
|
158
162
|
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes
|
|
@@ -248,9 +252,8 @@ var GatewayIntentBits;
|
|
|
248
252
|
/**
|
|
249
253
|
* @deprecated This is the old name for {@apilink GatewayIntentBits#GuildModeration}
|
|
250
254
|
*/
|
|
251
|
-
// biome-ignore lint/correctness/noUndeclaredVariables: no reason lmao
|
|
252
255
|
GatewayIntentBits[GatewayIntentBits["GuildBans"] = 4] = "GuildBans";
|
|
253
|
-
GatewayIntentBits[GatewayIntentBits["
|
|
256
|
+
GatewayIntentBits[GatewayIntentBits["GuildExpressions"] = 8] = "GuildExpressions";
|
|
254
257
|
GatewayIntentBits[GatewayIntentBits["GuildIntegrations"] = 16] = "GuildIntegrations";
|
|
255
258
|
GatewayIntentBits[GatewayIntentBits["GuildWebhooks"] = 32] = "GuildWebhooks";
|
|
256
259
|
GatewayIntentBits[GatewayIntentBits["GuildInvites"] = 64] = "GuildInvites";
|
|
@@ -312,6 +315,9 @@ var GatewayDispatchEvents;
|
|
|
312
315
|
GatewayDispatchEvents["StageInstanceCreate"] = "STAGE_INSTANCE_CREATE";
|
|
313
316
|
GatewayDispatchEvents["StageInstanceDelete"] = "STAGE_INSTANCE_DELETE";
|
|
314
317
|
GatewayDispatchEvents["StageInstanceUpdate"] = "STAGE_INSTANCE_UPDATE";
|
|
318
|
+
GatewayDispatchEvents["SubscriptionCreate"] = "SUBSCRIPTION_CREATE";
|
|
319
|
+
GatewayDispatchEvents["SubscriptionUpdate"] = "SUBSCRIPTION_UPDATE";
|
|
320
|
+
GatewayDispatchEvents["SubscriptionDelete"] = "SUBSCRIPTION_DELETE";
|
|
315
321
|
GatewayDispatchEvents["Ready"] = "READY";
|
|
316
322
|
GatewayDispatchEvents["Resumed"] = "RESUMED";
|
|
317
323
|
GatewayDispatchEvents["ThreadCreate"] = "THREAD_CREATE";
|
|
@@ -333,6 +339,11 @@ var GatewayDispatchEvents;
|
|
|
333
339
|
GatewayDispatchEvents["GuildScheduledEventDelete"] = "GUILD_SCHEDULED_EVENT_DELETE";
|
|
334
340
|
GatewayDispatchEvents["GuildScheduledEventUserAdd"] = "GUILD_SCHEDULED_EVENT_USER_ADD";
|
|
335
341
|
GatewayDispatchEvents["GuildScheduledEventUserRemove"] = "GUILD_SCHEDULED_EVENT_USER_REMOVE";
|
|
342
|
+
GatewayDispatchEvents["GuildSoundboardSoundCreate"] = "GUILD_SOUNDBOARD_SOUND_CREATE";
|
|
343
|
+
GatewayDispatchEvents["GuildSoundboardSoundUpdate"] = "GUILD_SOUNDBOARD_SOUND_UPDATE";
|
|
344
|
+
GatewayDispatchEvents["GuildSoundboardSoundDelete"] = "GUILD_SOUNDBOARD_SOUND_DELETE";
|
|
345
|
+
GatewayDispatchEvents["GuildSoundboardSoundsUpdate"] = "GUILD_SOUNDBOARD_SOUNDS_UPDATE";
|
|
346
|
+
GatewayDispatchEvents["SoundboardSounds"] = "SOUNDBOARD_SOUNDS";
|
|
336
347
|
GatewayDispatchEvents["AutoModerationRuleCreate"] = "AUTO_MODERATION_RULE_CREATE";
|
|
337
348
|
GatewayDispatchEvents["AutoModerationRuleUpdate"] = "AUTO_MODERATION_RULE_UPDATE";
|
|
338
349
|
GatewayDispatchEvents["AutoModerationRuleDelete"] = "AUTO_MODERATION_RULE_DELETE";
|
|
@@ -766,21 +777,29 @@ var GuildMemberFlags;
|
|
|
766
777
|
*/
|
|
767
778
|
GuildMemberFlags[GuildMemberFlags["StartedOnboarding"] = 8] = "StartedOnboarding";
|
|
768
779
|
/**
|
|
769
|
-
*
|
|
780
|
+
* Member is a guest and can only access the voice channel they were invited to
|
|
781
|
+
*/
|
|
782
|
+
GuildMemberFlags[GuildMemberFlags["IsGuest"] = 16] = "IsGuest";
|
|
783
|
+
/**
|
|
784
|
+
* This guild member flag is currently not documented by Discord but has a known value which we will try to keep up to date.
|
|
770
785
|
*/
|
|
771
786
|
GuildMemberFlags[GuildMemberFlags["StartedHomeActions"] = 32] = "StartedHomeActions";
|
|
772
787
|
/**
|
|
773
|
-
*
|
|
788
|
+
* This guild member flag is currently not documented by Discord but has a known value which we will try to keep up to date.
|
|
774
789
|
*/
|
|
775
790
|
GuildMemberFlags[GuildMemberFlags["CompletedHomeActions"] = 64] = "CompletedHomeActions";
|
|
776
791
|
/**
|
|
777
|
-
*
|
|
792
|
+
* This guild member flag is currently not documented by Discord but has a known value which we will try to keep up to date.
|
|
778
793
|
*/
|
|
779
794
|
GuildMemberFlags[GuildMemberFlags["AutomodQuarantinedUsernameOrGuildNickname"] = 128] = "AutomodQuarantinedUsernameOrGuildNickname";
|
|
780
795
|
/**
|
|
781
|
-
* @
|
|
796
|
+
* @deprecated This guild member flag is currently not documented by Discord but has a known value which we will try to keep up to date.
|
|
782
797
|
*/
|
|
783
798
|
GuildMemberFlags[GuildMemberFlags["AutomodQuarantinedBio"] = 256] = "AutomodQuarantinedBio";
|
|
799
|
+
/**
|
|
800
|
+
* Member has dismissed the DM settings upsell
|
|
801
|
+
*/
|
|
802
|
+
GuildMemberFlags[GuildMemberFlags["DmSettingsUpsellAcknowledged"] = 512] = "DmSettingsUpsellAcknowledged";
|
|
784
803
|
})(GuildMemberFlags || (exports.GuildMemberFlags = GuildMemberFlags = {}));
|
|
785
804
|
var OverwriteType;
|
|
786
805
|
(function (OverwriteType) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { RestToKeys } from '../common';
|
|
2
|
-
import type {
|
|
2
|
+
import type { APIAuditLogEntry, APIAutoModerationRule, APIChannel, APIEntitlement, APIGuild, APIGuildMember, APIGuildScheduledEvent, APIStageInstance, APISubscription, APIUser, GatewayActivity, GatewayAutoModerationActionExecutionDispatchData, GatewayChannelPinsUpdateDispatchData, GatewayChannelUpdateDispatchData, GatewayEntitlementCreateDispatchData, GatewayGuildBanAddDispatchData, GatewayGuildBanRemoveDispatchData, GatewayGuildCreateDispatchData, GatewayGuildDeleteDispatchData, GatewayGuildEmojisUpdateDispatchData, GatewayGuildIntegrationsUpdateDispatchData, GatewayGuildMemberAddDispatchData, GatewayGuildMemberRemoveDispatchData, GatewayGuildMemberUpdateDispatchData, GatewayGuildMembersChunkDispatchData, GatewayGuildRoleCreateDispatchData, GatewayGuildRoleDeleteDispatchData, GatewayGuildRoleUpdateDispatchData, GatewayGuildScheduledEventUserRemoveDispatchData, GatewayGuildSoundboardSoundDeleteDispatchData, GatewayGuildSoundboardSoundsUpdateDispatchData, GatewayGuildStickersUpdateDispatchData, GatewayIntegrationCreateDispatchData, GatewayIntegrationDeleteDispatchData, GatewayInteractionCreateDispatchData, GatewayInviteCreateDispatchData, GatewayInviteDeleteDispatchData, GatewayMessageCreateDispatchData, GatewayMessageDeleteBulkDispatchData, GatewayMessageDeleteDispatchData, GatewayMessagePollVoteDispatchData, GatewayMessageReactionAddDispatchData, GatewayMessageReactionRemoveAllDispatchData, GatewayMessageReactionRemoveDispatchData, GatewayMessageReactionRemoveEmojiDispatchData, GatewayMessageUpdateDispatchData, GatewayPresenceUpdateData, GatewayPresenceUpdateDispatchData, GatewayReadyDispatchData, GatewayRequestGuildMembersDataWithQuery, GatewayRequestGuildMembersDataWithUserIds, GatewaySoundboardSoundsDispatchData, GatewayThreadCreateDispatchData, GatewayThreadDeleteDispatchData, GatewayThreadListSyncDispatchData, GatewayThreadMemberUpdateDispatchData, GatewayThreadMembersUpdateDispatchData, GatewayTypingStartDispatchData, GatewayUserUpdateDispatchData, GatewayVoiceChannelEffectSendDispachData, GatewayVoiceServerUpdateDispatchData, GatewayVoiceStateUpdateData, GatewayWebhooksUpdateDispatchData, PresenceUpdateStatus } from '../types';
|
|
3
3
|
import { GatewayDispatchEvents } from '../types';
|
|
4
|
+
import type { APISoundBoard } from '../types/payloads/soundboard';
|
|
4
5
|
/** https://discord.com/developers/docs/topics/gateway-events#update-presence */
|
|
5
6
|
export interface StatusUpdate {
|
|
6
7
|
/** The user's activities */
|
|
@@ -55,6 +56,9 @@ export interface Events {
|
|
|
55
56
|
[GatewayDispatchEvents.GuildEmojisUpdate]: GatewayGuildEmojisUpdateDispatchData;
|
|
56
57
|
[GatewayDispatchEvents.GuildStickersUpdate]: GatewayGuildStickersUpdateDispatchData;
|
|
57
58
|
[GatewayDispatchEvents.GuildIntegrationsUpdate]: GatewayGuildIntegrationsUpdateDispatchData;
|
|
59
|
+
[GatewayDispatchEvents.GuildSoundboardSoundsUpdate]: GatewayGuildSoundboardSoundsUpdateDispatchData;
|
|
60
|
+
[GatewayDispatchEvents.GuildSoundboardSoundDelete]: GatewayGuildSoundboardSoundDeleteDispatchData;
|
|
61
|
+
[GatewayDispatchEvents.SoundboardSounds]: GatewaySoundboardSoundsDispatchData;
|
|
58
62
|
[GatewayDispatchEvents.GuildMemberAdd]: GatewayGuildMemberAddDispatchData;
|
|
59
63
|
[GatewayDispatchEvents.GuildMemberRemove]: GatewayGuildMemberRemoveDispatchData;
|
|
60
64
|
[GatewayDispatchEvents.GuildMemberUpdate]: GatewayGuildMemberUpdateDispatchData;
|
|
@@ -81,6 +85,7 @@ export interface Events {
|
|
|
81
85
|
[GatewayDispatchEvents.VoiceServerUpdate]: GatewayVoiceServerUpdateDispatchData;
|
|
82
86
|
[GatewayDispatchEvents.WebhooksUpdate]: GatewayWebhooksUpdateDispatchData;
|
|
83
87
|
[GatewayDispatchEvents.InteractionCreate]: GatewayInteractionCreateDispatchData;
|
|
88
|
+
[GatewayDispatchEvents.EntitlementCreate]: GatewayEntitlementCreateDispatchData;
|
|
84
89
|
}
|
|
85
90
|
export type StageSameEvents = RestToKeys<[
|
|
86
91
|
APIStageInstance,
|
|
@@ -123,11 +128,21 @@ export type AutoModetaractionRuleEvents = RestToKeys<[
|
|
|
123
128
|
]>;
|
|
124
129
|
export type EntitlementEvents = RestToKeys<[
|
|
125
130
|
APIEntitlement,
|
|
126
|
-
GatewayDispatchEvents.EntitlementCreate,
|
|
127
131
|
GatewayDispatchEvents.EntitlementDelete,
|
|
128
132
|
GatewayDispatchEvents.EntitlementUpdate
|
|
129
133
|
]>;
|
|
130
|
-
export type
|
|
134
|
+
export type SubscriptionEvents = RestToKeys<[
|
|
135
|
+
APISubscription,
|
|
136
|
+
GatewayDispatchEvents.SubscriptionCreate,
|
|
137
|
+
GatewayDispatchEvents.SubscriptionDelete,
|
|
138
|
+
GatewayDispatchEvents.SubscriptionUpdate
|
|
139
|
+
]>;
|
|
140
|
+
export type SoundboardSoundsEvents = RestToKeys<[
|
|
141
|
+
APISoundBoard,
|
|
142
|
+
GatewayDispatchEvents.GuildSoundboardSoundCreate,
|
|
143
|
+
GatewayDispatchEvents.GuildSoundboardSoundUpdate
|
|
144
|
+
]>;
|
|
145
|
+
export type NormalizeEvents = Events & AutoModetaractionRuleEvents & ChannelSameEvents & GuildScheduledSameEvents & GuildScheduledUserSameEvents & IntegrationSameEvents & EntitlementEvents & PollVoteSameEvents & StageSameEvents & SubscriptionEvents & SoundboardSoundsEvents & {
|
|
131
146
|
RAW: GatewayDispatchEvents;
|
|
132
147
|
};
|
|
133
148
|
export type GatewayEvents = {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DeepPartial } from '../../common';
|
|
1
2
|
import type { ShardManagerOptions, WorkerManagerOptions } from '../discord';
|
|
2
3
|
declare const COMPRESS = false;
|
|
3
4
|
declare const properties: {
|
|
@@ -5,8 +6,8 @@ declare const properties: {
|
|
|
5
6
|
browser: string;
|
|
6
7
|
device: string;
|
|
7
8
|
};
|
|
8
|
-
declare const ShardManagerDefaults:
|
|
9
|
-
declare const WorkerManagerDefaults:
|
|
9
|
+
declare const ShardManagerDefaults: DeepPartial<ShardManagerOptions>;
|
|
10
|
+
declare const WorkerManagerDefaults: DeepPartial<WorkerManagerOptions>;
|
|
10
11
|
export interface IdentifyProperties {
|
|
11
12
|
/**
|
|
12
13
|
* Operating system the shard runs on.
|
|
@@ -17,14 +17,14 @@ const ShardManagerDefaults = {
|
|
|
17
17
|
properties,
|
|
18
18
|
version: 10,
|
|
19
19
|
shardStart: 0,
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
resharding: {
|
|
21
|
+
interval: 8 * 60 * 60 * 1e3, // 8h
|
|
22
|
+
percentage: 80,
|
|
22
23
|
},
|
|
23
24
|
};
|
|
24
25
|
exports.ShardManagerDefaults = ShardManagerDefaults;
|
|
25
26
|
const WorkerManagerDefaults = {
|
|
26
27
|
...ShardManagerDefaults,
|
|
27
|
-
shardsPerWorker:
|
|
28
|
-
handlePayload: (_shardId, _workerId, _packet) => { },
|
|
28
|
+
shardsPerWorker: 16,
|
|
29
29
|
};
|
|
30
30
|
exports.WorkerManagerDefaults = WorkerManagerDefaults;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SeyfertWebSocket } from './socket/custom';
|
|
2
2
|
export declare class BaseSocket {
|
|
3
3
|
private internal;
|
|
4
|
-
ping
|
|
4
|
+
ping: () => Promise<number>;
|
|
5
5
|
constructor(kind: 'ws' | 'bun', url: string);
|
|
6
6
|
set onopen(callback: SeyfertWebSocket['onopen']);
|
|
7
7
|
set onmessage(callback: SeyfertWebSocket['onmessage']);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Logger, type MakeRequired } from '../../common';
|
|
2
|
+
import { type GatewayReceivePayload, type GatewaySendPayload } from '../../types';
|
|
2
3
|
import { DynamicBucket } from '../structures';
|
|
3
4
|
import { ConnectTimeout } from '../structures/timeout';
|
|
4
5
|
import { BaseSocket } from './basesocket';
|
|
5
6
|
import type { ShardData, ShardOptions } from './shared';
|
|
6
|
-
import { type GatewaySendPayload, type GatewayReceivePayload } from '../../types';
|
|
7
7
|
export interface ShardHeart {
|
|
8
8
|
interval: number;
|
|
9
9
|
nodeInterval?: NodeJS.Timeout;
|
|
@@ -13,6 +13,7 @@ export interface ShardHeart {
|
|
|
13
13
|
}
|
|
14
14
|
export declare class Shard {
|
|
15
15
|
id: number;
|
|
16
|
+
logger: Logger;
|
|
16
17
|
debugger?: Logger;
|
|
17
18
|
data: Partial<ShardData> | ShardData;
|
|
18
19
|
websocket: BaseSocket | null;
|
|
@@ -42,7 +43,7 @@ export declare class Shard {
|
|
|
42
43
|
reason: string;
|
|
43
44
|
}): Promise<void>;
|
|
44
45
|
close(code: number, reason: string): Promise<void>;
|
|
45
|
-
protected handleMessage(data: string | Buffer): Promise<void
|
|
46
|
+
protected handleMessage(data: string | Buffer): Promise<void> | undefined;
|
|
46
47
|
checkOffline(force: boolean): Promise<unknown>;
|
|
47
48
|
calculateSafeRequests(): number;
|
|
48
49
|
}
|
|
@@ -3,14 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Shard = void 0;
|
|
4
4
|
const node_zlib_1 = require("node:zlib");
|
|
5
5
|
const common_1 = require("../../common");
|
|
6
|
+
const types_1 = require("../../types");
|
|
6
7
|
const constants_1 = require("../constants");
|
|
7
8
|
const structures_1 = require("../structures");
|
|
8
9
|
const timeout_1 = require("../structures/timeout");
|
|
9
10
|
const basesocket_1 = require("./basesocket");
|
|
10
11
|
const shared_1 = require("./shared");
|
|
11
|
-
const types_1 = require("../../types");
|
|
12
12
|
class Shard {
|
|
13
13
|
id;
|
|
14
|
+
logger;
|
|
14
15
|
debugger;
|
|
15
16
|
data = {
|
|
16
17
|
resume_seq: null,
|
|
@@ -33,6 +34,10 @@ class Shard {
|
|
|
33
34
|
maxRequestsPerRateLimitTick: 120,
|
|
34
35
|
},
|
|
35
36
|
});
|
|
37
|
+
this.logger = new common_1.Logger({
|
|
38
|
+
name: `[Shard #${id}]`,
|
|
39
|
+
logLevel: common_1.LogLevels.Info,
|
|
40
|
+
});
|
|
36
41
|
if (options.debugger)
|
|
37
42
|
this.debugger = options.debugger;
|
|
38
43
|
const safe = this.calculateSafeRequests();
|
|
@@ -60,13 +65,12 @@ class Shard {
|
|
|
60
65
|
ping() {
|
|
61
66
|
if (!this.websocket)
|
|
62
67
|
return Promise.resolve(Number.POSITIVE_INFINITY);
|
|
63
|
-
//@ts-expect-error
|
|
64
68
|
return this.websocket.ping();
|
|
65
69
|
}
|
|
66
70
|
async connect() {
|
|
67
71
|
await this.connectTimeout.wait();
|
|
68
72
|
if (this.isOpen) {
|
|
69
|
-
this.debugger?.debug(`[Shard #${this.id}]
|
|
73
|
+
this.debugger?.debug(`[Shard #${this.id}] Attempted to connect while open`);
|
|
70
74
|
return;
|
|
71
75
|
}
|
|
72
76
|
clearTimeout(this.heart.nodeInterval);
|
|
@@ -78,7 +82,7 @@ class Shard {
|
|
|
78
82
|
this.handleMessage(data);
|
|
79
83
|
};
|
|
80
84
|
this.websocket.onclose = (event) => this.handleClosed(event);
|
|
81
|
-
this.websocket.onerror = (event) => this.
|
|
85
|
+
this.websocket.onerror = (event) => this.logger.error(event);
|
|
82
86
|
this.websocket.onopen = () => {
|
|
83
87
|
this.heart.ack = true;
|
|
84
88
|
};
|
|
@@ -166,8 +170,10 @@ class Shard {
|
|
|
166
170
|
}
|
|
167
171
|
break;
|
|
168
172
|
case types_1.GatewayOpcodes.HeartbeatAck:
|
|
169
|
-
|
|
170
|
-
|
|
173
|
+
{
|
|
174
|
+
this.heart.ack = true;
|
|
175
|
+
this.heart.lastAck = Date.now();
|
|
176
|
+
}
|
|
171
177
|
break;
|
|
172
178
|
case types_1.GatewayOpcodes.Heartbeat:
|
|
173
179
|
this.heartbeat(true);
|
|
@@ -178,7 +184,7 @@ class Shard {
|
|
|
178
184
|
case types_1.GatewayOpcodes.InvalidSession:
|
|
179
185
|
if (packet.d) {
|
|
180
186
|
if (!this.resumable) {
|
|
181
|
-
return this.
|
|
187
|
+
return this.logger.fatal('This is a completely unexpected error message.');
|
|
182
188
|
}
|
|
183
189
|
await this.resume();
|
|
184
190
|
}
|
|
@@ -192,8 +198,10 @@ class Shard {
|
|
|
192
198
|
{
|
|
193
199
|
switch (packet.t) {
|
|
194
200
|
case types_1.GatewayDispatchEvents.Resumed:
|
|
195
|
-
|
|
196
|
-
|
|
201
|
+
{
|
|
202
|
+
this.offlineSendQueue.map((resolve) => resolve());
|
|
203
|
+
this.options.handlePayload(this.id, packet);
|
|
204
|
+
}
|
|
197
205
|
break;
|
|
198
206
|
case types_1.GatewayDispatchEvents.Ready: {
|
|
199
207
|
this.data.resume_gateway_url = packet.d.resume_gateway_url;
|
|
@@ -212,7 +220,7 @@ class Shard {
|
|
|
212
220
|
}
|
|
213
221
|
async handleClosed(close) {
|
|
214
222
|
clearInterval(this.heart.nodeInterval);
|
|
215
|
-
this.
|
|
223
|
+
this.logger.warn(`${shared_1.ShardSocketCloseCodes[close.code] ?? types_1.GatewayCloseCodes[close.code] ?? close.code} (${close.code})`, close.reason);
|
|
216
224
|
switch (close.code) {
|
|
217
225
|
case shared_1.ShardSocketCloseCodes.Shutdown:
|
|
218
226
|
//Force disconnect, ignore
|
|
@@ -221,10 +229,12 @@ class Shard {
|
|
|
221
229
|
case types_1.GatewayCloseCodes.UnknownOpcode:
|
|
222
230
|
case types_1.GatewayCloseCodes.InvalidSeq:
|
|
223
231
|
case types_1.GatewayCloseCodes.SessionTimedOut:
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
232
|
+
{
|
|
233
|
+
this.data.resume_seq = 0;
|
|
234
|
+
this.data.session_id = undefined;
|
|
235
|
+
this.data.resume_gateway_url = undefined;
|
|
236
|
+
await this.reconnect();
|
|
237
|
+
}
|
|
228
238
|
break;
|
|
229
239
|
case 1001:
|
|
230
240
|
case 1006:
|
|
@@ -234,8 +244,10 @@ class Shard {
|
|
|
234
244
|
case types_1.GatewayCloseCodes.NotAuthenticated:
|
|
235
245
|
case types_1.GatewayCloseCodes.AlreadyAuthenticated:
|
|
236
246
|
case types_1.GatewayCloseCodes.RateLimited:
|
|
237
|
-
|
|
238
|
-
|
|
247
|
+
{
|
|
248
|
+
this.logger.info('Trying to reconnect');
|
|
249
|
+
await this.reconnect();
|
|
250
|
+
}
|
|
239
251
|
break;
|
|
240
252
|
case types_1.GatewayCloseCodes.AuthenticationFailed:
|
|
241
253
|
case types_1.GatewayCloseCodes.DisallowedIntents:
|
|
@@ -243,26 +255,37 @@ class Shard {
|
|
|
243
255
|
case types_1.GatewayCloseCodes.InvalidIntents:
|
|
244
256
|
case types_1.GatewayCloseCodes.InvalidShard:
|
|
245
257
|
case types_1.GatewayCloseCodes.ShardingRequired:
|
|
246
|
-
this.
|
|
258
|
+
this.logger.fatal('Cannot reconnect');
|
|
247
259
|
break;
|
|
248
260
|
default:
|
|
249
|
-
|
|
250
|
-
|
|
261
|
+
{
|
|
262
|
+
this.logger.warn('Unknown close code, trying to reconnect anyways');
|
|
263
|
+
await this.reconnect();
|
|
264
|
+
}
|
|
251
265
|
break;
|
|
252
266
|
}
|
|
253
267
|
}
|
|
254
268
|
async close(code, reason) {
|
|
269
|
+
clearInterval(this.heart.nodeInterval);
|
|
255
270
|
if (!this.isOpen) {
|
|
256
|
-
return this.debugger?.warn(`[Shard #${this.id}] Is not open
|
|
271
|
+
return this.debugger?.warn(`[Shard #${this.id}] Is not open, reason:`, reason);
|
|
257
272
|
}
|
|
258
|
-
this.debugger?.
|
|
273
|
+
this.debugger?.debug(`[Shard #${this.id}] Called close with reason:`, reason);
|
|
259
274
|
this.websocket?.close(code, reason);
|
|
260
275
|
}
|
|
261
276
|
handleMessage(data) {
|
|
262
|
-
|
|
263
|
-
|
|
277
|
+
let packet;
|
|
278
|
+
try {
|
|
279
|
+
if (data instanceof Buffer) {
|
|
280
|
+
data = (0, node_zlib_1.inflateSync)(data);
|
|
281
|
+
}
|
|
282
|
+
packet = JSON.parse(data);
|
|
283
|
+
}
|
|
284
|
+
catch (e) {
|
|
285
|
+
this.logger.error(e);
|
|
286
|
+
return;
|
|
264
287
|
}
|
|
265
|
-
return this.onpacket(
|
|
288
|
+
return this.onpacket(packet);
|
|
266
289
|
}
|
|
267
290
|
checkOffline(force) {
|
|
268
291
|
if (!this.isOpen) {
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { Logger, type MakeRequired } from '../../common';
|
|
2
|
-
import
|
|
2
|
+
import type { MakeDeepPartial } from '../../common/types/util';
|
|
3
|
+
import { type GatewaySendPayload, type GatewayUpdatePresence, type GatewayVoiceStateUpdate } from '../../types';
|
|
3
4
|
import { ShardManagerDefaults } from '../constants';
|
|
4
5
|
import { ConnectQueue } from '../structures/timeout';
|
|
5
6
|
import { Shard } from './shard';
|
|
6
|
-
import type { ShardManagerOptions } from './shared';
|
|
7
|
+
import type { ShardData, ShardManagerOptions } from './shared';
|
|
7
8
|
export declare class ShardManager extends Map<number, Shard> {
|
|
8
9
|
connectQueue: ConnectQueue;
|
|
9
10
|
options: MakeRequired<ShardManagerOptions, keyof typeof ShardManagerDefaults>;
|
|
10
11
|
debugger?: Logger;
|
|
11
|
-
constructor(options: ShardManagerOptions);
|
|
12
|
+
constructor(options: MakeDeepPartial<ShardManagerOptions, 'resharding'>);
|
|
12
13
|
get totalShards(): number;
|
|
13
14
|
get shardStart(): number;
|
|
14
15
|
get shardEnd(): number;
|
|
@@ -16,15 +17,17 @@ export declare class ShardManager extends Map<number, Shard> {
|
|
|
16
17
|
get concurrency(): number;
|
|
17
18
|
get latency(): number;
|
|
18
19
|
calculateShardId(guildId: string): number;
|
|
19
|
-
|
|
20
|
+
create(shardId: number): Shard;
|
|
20
21
|
spawnShards(): Promise<void>;
|
|
22
|
+
startResharder(): Promise<void>;
|
|
21
23
|
spawnBuckets(): Shard[][];
|
|
22
24
|
forceIdentify(shardId: number): Promise<void>;
|
|
23
25
|
disconnect(shardId: number): Promise<void> | undefined;
|
|
24
|
-
disconnectAll():
|
|
26
|
+
disconnectAll(): void;
|
|
25
27
|
setShardPresence(shardId: number, payload: GatewayUpdatePresence['d']): void;
|
|
26
|
-
setPresence(payload: GatewayUpdatePresence['d']):
|
|
28
|
+
setPresence(payload: GatewayUpdatePresence['d']): void;
|
|
27
29
|
joinVoice(guild_id: string, channel_id: string, options: Pick<GatewayVoiceStateUpdate['d'], 'self_deaf' | 'self_mute'>): void;
|
|
28
30
|
leaveVoice(guild_id: string): void;
|
|
29
31
|
send<T extends GatewaySendPayload>(shardId: number, payload: T): void;
|
|
32
|
+
resume(shardId: number, shardData: MakeRequired<ShardData>): unknown;
|
|
30
33
|
}
|