seyfert 2.1.0 → 2.1.1-dev-11316886063.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 +6 -6
- package/lib/api/Routes/invites.d.ts +3 -4
- package/lib/api/Routes/skus.d.ts +4 -5
- 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 +12 -10
- package/lib/api/shared.d.ts +1 -1
- package/lib/api/utils/constants.d.ts +2 -0
- package/lib/api/utils/constants.js +2 -1
- package/lib/builders/ActionRow.d.ts +1 -1
- package/lib/builders/Attachment.d.ts +2 -2
- package/lib/builders/Attachment.js +1 -1
- 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 +8 -11
- package/lib/cache/index.js +38 -37
- 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 +9 -14
- package/lib/client/base.js +43 -44
- package/lib/client/client.d.ts +3 -7
- package/lib/client/client.js +24 -41
- package/lib/client/collectors.js +1 -1
- package/lib/client/httpclient.d.ts +1 -1
- package/lib/client/transformers.d.ts +37 -34
- package/lib/client/transformers.js +66 -63
- package/lib/client/workerclient.d.ts +10 -11
- package/lib/client/workerclient.js +180 -75
- package/lib/collection.d.ts +3 -3
- package/lib/commands/applications/chat.d.ts +12 -32
- 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 +1 -1
- package/lib/commands/applications/entrycontext.d.ts +6 -6
- package/lib/commands/applications/entrycontext.js +4 -4
- 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 +104 -28
- package/lib/commands/applications/options.js +4 -4
- package/lib/commands/applications/shared.d.ts +5 -2
- package/lib/commands/basecontext.d.ts +1 -1
- package/lib/commands/decorators.d.ts +10 -10
- package/lib/commands/decorators.js +5 -4
- package/lib/commands/handle.d.ts +9 -9
- package/lib/commands/handle.js +94 -68
- package/lib/commands/handler.d.ts +5 -5
- package/lib/commands/handler.js +21 -17
- package/lib/commands/optionresolver.d.ts +4 -4
- package/lib/commands/optionresolver.js +3 -3
- 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 +4 -3
- package/lib/common/it/utils.js +52 -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 +1 -1
- 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/events/handler.d.ts +5 -5
- package/lib/events/handler.js +66 -16
- 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/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/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 +17 -14
- package/lib/structures/Interaction.js +28 -21
- package/lib/structures/Message.d.ts +4 -7
- package/lib/structures/Message.js +5 -5
- 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 +6 -5
- 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 +53 -5
- package/lib/types/payloads/_interactions/base.d.ts +1 -1
- package/lib/types/payloads/channel.d.ts +2 -2
- 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/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 +2 -2
- 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/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 +1 -1
- package/lib/types/utils/index.d.ts +11 -2
- package/lib/types/utils/index.js +10 -2
- package/lib/websocket/SharedTypes.d.ts +11 -2
- package/lib/websocket/constants/index.js +0 -10
- package/lib/websocket/discord/basesocket.d.ts +1 -1
- package/lib/websocket/discord/shard.d.ts +1 -1
- package/lib/websocket/discord/shard.js +25 -16
- package/lib/websocket/discord/sharder.d.ts +9 -6
- package/lib/websocket/discord/sharder.js +91 -74
- package/lib/websocket/discord/shared.d.ts +3 -14
- package/lib/websocket/discord/socket/custom.js +19 -6
- package/lib/websocket/discord/worker.d.ts +8 -2
- package/lib/websocket/discord/workermanager.d.ts +42 -17
- package/lib/websocket/discord/workermanager.js +144 -37
- package/lib/websocket/structures/timeout.d.ts +4 -5
- package/lib/websocket/structures/timeout.js +23 -24
- package/package.json +72 -70
- package/lib/cache/resources/threads.d.ts +0 -14
- package/lib/cache/resources/threads.js +0 -32
|
@@ -1,16 +1,23 @@
|
|
|
1
|
-
import type { GatewayPresenceUpdateData, GatewaySendPayload } from '../../types';
|
|
2
1
|
import { type Worker as ClusterWorker } from 'node:cluster';
|
|
3
2
|
import { ApiHandler, Logger } from '../..';
|
|
4
3
|
import { type Adapter } from '../../cache';
|
|
5
4
|
import { type MakePartial } from '../../common';
|
|
5
|
+
import type { GatewayPresenceUpdateData, GatewaySendPayload } from '../../types';
|
|
6
6
|
import { ConnectQueue } from '../structures/timeout';
|
|
7
7
|
import type { ShardOptions, WorkerData, WorkerManagerOptions } from './shared';
|
|
8
8
|
import type { WorkerInfo, WorkerMessage, WorkerShardInfo } from './worker';
|
|
9
9
|
export declare class WorkerManager extends Map<number, (ClusterWorker | import('node:worker_threads').Worker | {
|
|
10
|
-
ready
|
|
10
|
+
ready?: boolean;
|
|
11
11
|
}) & {
|
|
12
12
|
ready?: boolean;
|
|
13
|
+
disconnected?: boolean;
|
|
14
|
+
resharded?: boolean;
|
|
13
15
|
}> {
|
|
16
|
+
static prepareSpaces(options: {
|
|
17
|
+
shardStart: number;
|
|
18
|
+
shardEnd: number;
|
|
19
|
+
shardsPerWorker: number;
|
|
20
|
+
}, logger?: Logger): number[][];
|
|
14
21
|
options: MakePartial<Required<WorkerManagerOptions>, 'adapter'>;
|
|
15
22
|
debugger?: Logger;
|
|
16
23
|
connectQueue: ConnectQueue;
|
|
@@ -21,7 +28,11 @@ export declare class WorkerManager extends Map<number, (ClusterWorker | import('
|
|
|
21
28
|
timeout: NodeJS.Timeout;
|
|
22
29
|
}>;
|
|
23
30
|
rest: ApiHandler;
|
|
24
|
-
|
|
31
|
+
reshardingWorkerQueue: (() => void)[];
|
|
32
|
+
private _info?;
|
|
33
|
+
constructor(options: Omit<MakePartial<WorkerManagerOptions, 'token' | 'intents' | 'info' | 'handlePayload'>, 'resharding'> & {
|
|
34
|
+
resharding?: MakePartial<NonNullable<WorkerManagerOptions['resharding']>, 'getInfo'>;
|
|
35
|
+
});
|
|
25
36
|
setCache(adapter: Adapter): void;
|
|
26
37
|
setRest(rest: ApiHandler): void;
|
|
27
38
|
get remaining(): number;
|
|
@@ -31,36 +42,50 @@ export declare class WorkerManager extends Map<number, (ClusterWorker | import('
|
|
|
31
42
|
get shardStart(): number;
|
|
32
43
|
get shardEnd(): number;
|
|
33
44
|
get shardsPerWorker(): number;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
shardId?: number;
|
|
45
|
+
syncLatency({ shardId, workerId, }: {
|
|
46
|
+
shardId: number;
|
|
37
47
|
workerId?: number;
|
|
38
|
-
}
|
|
48
|
+
} | {
|
|
49
|
+
shardId?: number;
|
|
50
|
+
workerId: number;
|
|
51
|
+
}): Promise<number>;
|
|
39
52
|
calculateShardId(guildId: string): number;
|
|
40
53
|
calculateWorkerId(shardId: number): number;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
54
|
+
postMessage(id: number, body: ManagerMessages): void;
|
|
55
|
+
prepareWorkers(shards: number[][], resharding?: boolean): Promise<void>;
|
|
56
|
+
createWorker(workerData: WorkerData): ClusterWorker | import("worker_threads").Worker | ({
|
|
57
|
+
ready?: boolean;
|
|
58
|
+
} & {
|
|
59
|
+
ready?: boolean;
|
|
60
|
+
disconnected?: boolean;
|
|
61
|
+
resharded?: boolean;
|
|
62
|
+
});
|
|
63
|
+
spawn(workerId: number, shardId: number, resharding?: boolean): void;
|
|
48
64
|
handleWorkerMessage(message: WorkerMessage): Promise<void>;
|
|
49
65
|
private generateNonce;
|
|
50
66
|
private generateSendPromise;
|
|
51
67
|
send(data: GatewaySendPayload, shardId: number): Promise<true>;
|
|
52
68
|
getShardInfo(shardId: number): Promise<WorkerShardInfo>;
|
|
53
69
|
getWorkerInfo(workerId: number): Promise<WorkerInfo>;
|
|
54
|
-
start(): Promise<void
|
|
70
|
+
start(): Promise<void>;
|
|
71
|
+
startResharding(): Promise<void>;
|
|
55
72
|
}
|
|
56
|
-
type CreateManagerMessage<T extends string, D extends object =
|
|
73
|
+
type CreateManagerMessage<T extends string, D extends object = object> = {
|
|
57
74
|
type: T;
|
|
58
75
|
} & D;
|
|
59
76
|
export type ManagerAllowConnect = CreateManagerMessage<'ALLOW_CONNECT', {
|
|
60
77
|
shardId: number;
|
|
61
78
|
presence: GatewayPresenceUpdateData;
|
|
62
79
|
}>;
|
|
80
|
+
export type ManagerAllowConnectResharding = CreateManagerMessage<'ALLOW_CONNECT_RESHARDING', {
|
|
81
|
+
shardId: number;
|
|
82
|
+
presence: GatewayPresenceUpdateData;
|
|
83
|
+
}>;
|
|
84
|
+
export type ManagerWorkerAlreadyExistsResharding = CreateManagerMessage<'WORKER_ALREADY_EXISTS_RESHARDING'>;
|
|
63
85
|
export type ManagerSpawnShards = CreateManagerMessage<'SPAWN_SHARDS', Pick<ShardOptions, 'info' | 'properties' | 'compress'>>;
|
|
86
|
+
export type ManagerSpawnShardsResharding = CreateManagerMessage<'SPAWN_SHARDS_RESHARDING', Pick<ShardOptions, 'info' | 'properties' | 'compress'>>;
|
|
87
|
+
export type DisconnectAllShardsResharding = CreateManagerMessage<'DISCONNECT_ALL_SHARDS_RESHARDING'>;
|
|
88
|
+
export type ConnnectAllShardsResharding = CreateManagerMessage<'CONNECT_ALL_SHARDS_RESHARDING'>;
|
|
64
89
|
export type ManagerSendPayload = CreateManagerMessage<'SEND_PAYLOAD', GatewaySendPayload & {
|
|
65
90
|
shardId: number;
|
|
66
91
|
nonce: string;
|
|
@@ -91,5 +116,5 @@ export type ManagerSendEvalResponse = CreateManagerMessage<'EVAL_RESPONSE', {
|
|
|
91
116
|
response: any;
|
|
92
117
|
nonce: string;
|
|
93
118
|
}>;
|
|
94
|
-
export type ManagerMessages = ManagerAllowConnect | ManagerSpawnShards | ManagerSendPayload | ManagerRequestShardInfo | ManagerRequestWorkerInfo | ManagerSendCacheResult | ManagerSendBotReady | ManagerSendApiResponse | ManagerSendEvalResponse | ManagerExecuteEval;
|
|
119
|
+
export type ManagerMessages = ManagerAllowConnect | ManagerSpawnShards | ManagerSendPayload | ManagerRequestShardInfo | ManagerRequestWorkerInfo | ManagerSendCacheResult | ManagerSendBotReady | ManagerSendApiResponse | ManagerSendEvalResponse | ManagerExecuteEval | ManagerWorkerAlreadyExistsResharding | ManagerSpawnShardsResharding | ManagerAllowConnectResharding | DisconnectAllShardsResharding | ConnnectAllShardsResharding;
|
|
95
120
|
export {};
|
|
@@ -14,6 +14,18 @@ const constants_1 = require("../constants");
|
|
|
14
14
|
const structures_1 = require("../structures");
|
|
15
15
|
const timeout_1 = require("../structures/timeout");
|
|
16
16
|
class WorkerManager extends Map {
|
|
17
|
+
static prepareSpaces(options, logger) {
|
|
18
|
+
logger?.info('Preparing buckets', options);
|
|
19
|
+
const chunks = structures_1.DynamicBucket.chunk(new Array(options.shardEnd - options.shardStart), options.shardsPerWorker);
|
|
20
|
+
chunks.forEach((shards, index) => {
|
|
21
|
+
for (let i = 0; i < shards.length; i++) {
|
|
22
|
+
const id = i + (index > 0 ? index * options.shardsPerWorker : 0) + options.shardStart;
|
|
23
|
+
chunks[index][i] = id;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
logger?.info(`${chunks.length} buckets created`);
|
|
27
|
+
return chunks;
|
|
28
|
+
}
|
|
17
29
|
options;
|
|
18
30
|
debugger;
|
|
19
31
|
connectQueue;
|
|
@@ -21,6 +33,8 @@ class WorkerManager extends Map {
|
|
|
21
33
|
cacheAdapter;
|
|
22
34
|
promises = new Map();
|
|
23
35
|
rest;
|
|
36
|
+
reshardingWorkerQueue = [];
|
|
37
|
+
_info;
|
|
24
38
|
constructor(options) {
|
|
25
39
|
super();
|
|
26
40
|
this.options = options;
|
|
@@ -53,12 +67,9 @@ class WorkerManager extends Map {
|
|
|
53
67
|
get shardsPerWorker() {
|
|
54
68
|
return this.options.shardsPerWorker;
|
|
55
69
|
}
|
|
56
|
-
|
|
57
|
-
return this.options.workers;
|
|
58
|
-
}
|
|
59
|
-
async syncLatency({ shardId, workerId }) {
|
|
70
|
+
async syncLatency({ shardId, workerId, }) {
|
|
60
71
|
if (typeof shardId !== 'number' && typeof workerId !== 'number') {
|
|
61
|
-
|
|
72
|
+
throw new Error('Undefined workerId and shardId');
|
|
62
73
|
}
|
|
63
74
|
const id = workerId ?? this.calculateWorkerId(shardId);
|
|
64
75
|
if (!this.has(id)) {
|
|
@@ -72,27 +83,15 @@ class WorkerManager extends Map {
|
|
|
72
83
|
}
|
|
73
84
|
calculateWorkerId(shardId) {
|
|
74
85
|
const workerId = Math.floor((shardId - this.shardStart) / this.shardsPerWorker);
|
|
75
|
-
if (workerId >= this.
|
|
86
|
+
if (workerId >= this.totalWorkers) {
|
|
76
87
|
throw new Error('Invalid shardId');
|
|
77
88
|
}
|
|
78
89
|
return workerId;
|
|
79
90
|
}
|
|
80
|
-
prepareSpaces() {
|
|
81
|
-
this.debugger?.info('Preparing buckets');
|
|
82
|
-
const chunks = structures_1.DynamicBucket.chunk(new Array(this.shardEnd - this.shardStart), this.options.shardsPerWorker);
|
|
83
|
-
chunks.forEach((shards, index) => {
|
|
84
|
-
for (let i = 0; i < shards.length; i++) {
|
|
85
|
-
const id = i + (index > 0 ? index * this.options.shardsPerWorker : 0) + this.shardStart;
|
|
86
|
-
chunks[index][i] = id;
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
this.debugger?.info(`${chunks.length} buckets created`);
|
|
90
|
-
return chunks;
|
|
91
|
-
}
|
|
92
91
|
postMessage(id, body) {
|
|
93
92
|
const worker = this.get(id);
|
|
94
93
|
if (!worker)
|
|
95
|
-
return this.debugger?.error(`Worker ${id}
|
|
94
|
+
return this.debugger?.error(`Worker ${id} does not exists.`);
|
|
96
95
|
switch (this.options.mode) {
|
|
97
96
|
case 'clusters':
|
|
98
97
|
worker.send(body);
|
|
@@ -105,14 +104,14 @@ class WorkerManager extends Map {
|
|
|
105
104
|
break;
|
|
106
105
|
}
|
|
107
106
|
}
|
|
108
|
-
async prepareWorkers(shards) {
|
|
107
|
+
async prepareWorkers(shards, resharding = false) {
|
|
109
108
|
const worker_threads = (0, common_1.lazyLoadPackage)('node:worker_threads');
|
|
110
109
|
if (!worker_threads)
|
|
111
110
|
throw new Error('Cannot prepare workers without worker_threads.');
|
|
112
111
|
for (let i = 0; i < shards.length; i++) {
|
|
113
112
|
const workerExists = this.has(i);
|
|
114
|
-
if (!workerExists) {
|
|
115
|
-
this
|
|
113
|
+
if (resharding || !workerExists) {
|
|
114
|
+
this[resharding ? 'reshardingWorkerQueue' : 'workerQueue'].push(() => {
|
|
116
115
|
const worker = this.createWorker({
|
|
117
116
|
path: this.options.path,
|
|
118
117
|
debug: this.options.debug,
|
|
@@ -121,8 +120,9 @@ class WorkerManager extends Map {
|
|
|
121
120
|
intents: this.options.intents,
|
|
122
121
|
workerId: i,
|
|
123
122
|
workerProxy: this.options.workerProxy,
|
|
124
|
-
totalShards: this.totalShards,
|
|
123
|
+
totalShards: resharding ? this._info.shards : this.totalShards,
|
|
125
124
|
mode: this.options.mode,
|
|
125
|
+
resharding,
|
|
126
126
|
});
|
|
127
127
|
this.set(i, worker);
|
|
128
128
|
});
|
|
@@ -130,12 +130,23 @@ class WorkerManager extends Map {
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
createWorker(workerData) {
|
|
133
|
+
if (this.has(workerData.workerId)) {
|
|
134
|
+
if (workerData.resharding) {
|
|
135
|
+
this.postMessage(workerData.workerId, {
|
|
136
|
+
type: 'WORKER_ALREADY_EXISTS_RESHARDING',
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
const worker = this.get(workerData.workerId);
|
|
140
|
+
return worker;
|
|
141
|
+
}
|
|
133
142
|
const worker_threads = (0, common_1.lazyLoadPackage)('node:worker_threads');
|
|
134
143
|
if (!worker_threads)
|
|
135
144
|
throw new Error('Cannot create worker without worker_threads.');
|
|
136
145
|
const env = {
|
|
137
146
|
SEYFERT_SPAWNING: 'true',
|
|
138
147
|
};
|
|
148
|
+
if (workerData.resharding)
|
|
149
|
+
env.SEYFERT_WORKER_RESHARDING = 'true';
|
|
139
150
|
for (const i in workerData) {
|
|
140
151
|
env[`SEYFERT_WORKER_${i.toUpperCase()}`] = workerData[i];
|
|
141
152
|
}
|
|
@@ -155,22 +166,23 @@ class WorkerManager extends Map {
|
|
|
155
166
|
worker.on('message', data => this.handleWorkerMessage(data));
|
|
156
167
|
return worker;
|
|
157
168
|
}
|
|
158
|
-
case 'custom':
|
|
169
|
+
case 'custom': {
|
|
159
170
|
this.options.adapter.spawn(workerData, env);
|
|
160
171
|
return {
|
|
161
172
|
ready: false,
|
|
162
173
|
};
|
|
174
|
+
}
|
|
163
175
|
}
|
|
164
176
|
}
|
|
165
|
-
spawn(workerId, shardId) {
|
|
177
|
+
spawn(workerId, shardId, resharding = false) {
|
|
166
178
|
this.connectQueue.push(() => {
|
|
167
179
|
const worker = this.has(workerId);
|
|
168
180
|
if (!worker) {
|
|
169
|
-
this.debugger?.fatal(
|
|
181
|
+
this.debugger?.fatal(`Trying ${resharding ? 'reshard' : 'spawn'} with worker that doesn't exist`);
|
|
170
182
|
return;
|
|
171
183
|
}
|
|
172
184
|
this.postMessage(workerId, {
|
|
173
|
-
type: 'ALLOW_CONNECT',
|
|
185
|
+
type: resharding ? 'ALLOW_CONNECT_RESHARDING' : 'ALLOW_CONNECT',
|
|
174
186
|
shardId,
|
|
175
187
|
presence: this.options.presence?.(shardId, workerId),
|
|
176
188
|
});
|
|
@@ -178,6 +190,66 @@ class WorkerManager extends Map {
|
|
|
178
190
|
}
|
|
179
191
|
async handleWorkerMessage(message) {
|
|
180
192
|
switch (message.type) {
|
|
193
|
+
case 'WORKER_READY_RESHARDING':
|
|
194
|
+
{
|
|
195
|
+
this.get(message.workerId).resharded = true;
|
|
196
|
+
if (!this.reshardingWorkerQueue.length && [...this.values()].every(w => w.resharded)) {
|
|
197
|
+
for (const [id] of this.entries()) {
|
|
198
|
+
this.postMessage(id, {
|
|
199
|
+
type: 'DISCONNECT_ALL_SHARDS_RESHARDING',
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
this.forEach(w => {
|
|
203
|
+
delete w.resharded;
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
const nextWorker = this.reshardingWorkerQueue.shift();
|
|
208
|
+
if (nextWorker) {
|
|
209
|
+
this.debugger?.info('Spawning next worker to reshard');
|
|
210
|
+
nextWorker();
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
this.debugger?.info('No more workers to reshard left');
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
break;
|
|
218
|
+
case 'DISCONNECTED_ALL_SHARDS_RESHARDING':
|
|
219
|
+
{
|
|
220
|
+
this.get(message.workerId).disconnected = true;
|
|
221
|
+
if ([...this.values()].every(w => w.disconnected)) {
|
|
222
|
+
this.options.totalShards = this._info.shards;
|
|
223
|
+
this.options.shardEnd = this.options.totalShards = this._info.shards;
|
|
224
|
+
this.options.workers = this.size;
|
|
225
|
+
delete this._info;
|
|
226
|
+
for (const [id] of this.entries()) {
|
|
227
|
+
this.postMessage(id, {
|
|
228
|
+
type: 'CONNECT_ALL_SHARDS_RESHARDING',
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
this.forEach(w => {
|
|
232
|
+
delete w.disconnected;
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
break;
|
|
237
|
+
case 'WORKER_START_RESHARDING':
|
|
238
|
+
{
|
|
239
|
+
this.postMessage(message.workerId, {
|
|
240
|
+
type: 'SPAWN_SHARDS_RESHARDING',
|
|
241
|
+
compress: this.options.compress ?? false,
|
|
242
|
+
info: {
|
|
243
|
+
...this.options.info,
|
|
244
|
+
shards: this._info.shards,
|
|
245
|
+
},
|
|
246
|
+
properties: {
|
|
247
|
+
...constants_1.properties,
|
|
248
|
+
...this.options.properties,
|
|
249
|
+
},
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
break;
|
|
181
253
|
case 'WORKER_START':
|
|
182
254
|
{
|
|
183
255
|
this.postMessage(message.workerId, {
|
|
@@ -194,6 +266,9 @@ class WorkerManager extends Map {
|
|
|
194
266
|
});
|
|
195
267
|
}
|
|
196
268
|
break;
|
|
269
|
+
case 'CONNECT_QUEUE_RESHARDING':
|
|
270
|
+
this.spawn(message.workerId, message.shardId, true);
|
|
271
|
+
break;
|
|
197
272
|
case 'CONNECT_QUEUE':
|
|
198
273
|
this.spawn(message.workerId, message.shardId);
|
|
199
274
|
break;
|
|
@@ -315,12 +390,11 @@ class WorkerManager extends Map {
|
|
|
315
390
|
break;
|
|
316
391
|
}
|
|
317
392
|
}
|
|
318
|
-
generateNonce(
|
|
393
|
+
generateNonce() {
|
|
319
394
|
const uuid = (0, node_crypto_1.randomUUID)();
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
return nonce;
|
|
395
|
+
if (this.promises.has(uuid))
|
|
396
|
+
return this.generateNonce();
|
|
397
|
+
return uuid;
|
|
324
398
|
}
|
|
325
399
|
generateSendPromise(nonce, message = 'Timeout') {
|
|
326
400
|
return new Promise((res, rej) => {
|
|
@@ -352,7 +426,7 @@ class WorkerManager extends Map {
|
|
|
352
426
|
if (!worker) {
|
|
353
427
|
throw new Error(`Worker #${workerId} doesnt exist`);
|
|
354
428
|
}
|
|
355
|
-
const nonce = this.generateNonce(
|
|
429
|
+
const nonce = this.generateNonce();
|
|
356
430
|
this.postMessage(workerId, { shardId, nonce, type: 'SHARD_INFO' });
|
|
357
431
|
return this.generateSendPromise(nonce, 'Get shard info timeout');
|
|
358
432
|
}
|
|
@@ -376,10 +450,11 @@ class WorkerManager extends Map {
|
|
|
376
450
|
domain: 'https://discord.com',
|
|
377
451
|
debug: this.options.debug,
|
|
378
452
|
});
|
|
379
|
-
this.options.info ??= await
|
|
453
|
+
this.options.info ??= await this.rest.proxy.gateway.bot.get();
|
|
380
454
|
this.options.shardEnd ??= this.options.totalShards ?? this.options.info.shards;
|
|
381
455
|
this.options.totalShards ??= this.options.shardEnd;
|
|
382
456
|
this.options = (0, common_1.MergeOptions)(constants_1.WorkerManagerDefaults, this.options);
|
|
457
|
+
this.options.resharding.getInfo ??= () => this.rest.proxy.gateway.bot.get();
|
|
383
458
|
this.options.workers ??= Math.ceil(this.options.totalShards / this.options.shardsPerWorker);
|
|
384
459
|
this.connectQueue = new timeout_1.ConnectQueue(5.5e3, this.concurrency);
|
|
385
460
|
if (this.options.debug) {
|
|
@@ -387,13 +462,45 @@ class WorkerManager extends Map {
|
|
|
387
462
|
name: '[WorkerManager]',
|
|
388
463
|
});
|
|
389
464
|
}
|
|
390
|
-
if (this.totalShards / this.shardsPerWorker > this.
|
|
465
|
+
if (this.totalShards / this.shardsPerWorker > this.totalWorkers) {
|
|
391
466
|
throw new Error(`Cannot create enough shards in the specified workers, minimum: ${Math.ceil(this.totalShards / this.shardsPerWorker)}`);
|
|
392
467
|
}
|
|
393
|
-
const spaces =
|
|
468
|
+
const spaces = WorkerManager.prepareSpaces({
|
|
469
|
+
shardStart: this.shardStart,
|
|
470
|
+
shardEnd: this.shardEnd,
|
|
471
|
+
shardsPerWorker: this.shardsPerWorker,
|
|
472
|
+
}, this.debugger);
|
|
394
473
|
await this.prepareWorkers(spaces);
|
|
395
474
|
// Start workers queue
|
|
396
|
-
|
|
475
|
+
this.workerQueue.shift()();
|
|
476
|
+
await this.startResharding();
|
|
477
|
+
}
|
|
478
|
+
async startResharding() {
|
|
479
|
+
if (this.options.resharding.interval <= 0)
|
|
480
|
+
return;
|
|
481
|
+
if (this.shardStart !== 0 || this.shardEnd !== this.totalShards)
|
|
482
|
+
return this.debugger?.debug('Cannot start resharder');
|
|
483
|
+
setInterval(async () => {
|
|
484
|
+
this.debugger?.debug('Checking if reshard is needed');
|
|
485
|
+
const info = await this.options.resharding.getInfo();
|
|
486
|
+
if (info.shards <= this.totalShards)
|
|
487
|
+
return this.debugger?.debug('Resharding not needed');
|
|
488
|
+
//https://github.com/discordeno/discordeno/blob/6a5f446c0651b9fad9f1550ff1857fe7a026426b/packages/gateway/src/manager.ts#L106C8-L106C94
|
|
489
|
+
const percentage = (info.shards / ((this.totalShards * 2500) / 1000)) * 100;
|
|
490
|
+
if (percentage < this.options.resharding.percentage)
|
|
491
|
+
return this.debugger?.debug(`Percentage is not enough to reshard ${percentage}/${this.options.resharding.percentage}`);
|
|
492
|
+
this.debugger?.info('Starting resharding process');
|
|
493
|
+
this._info = info;
|
|
494
|
+
this.connectQueue.concurrency = info.session_start_limit.max_concurrency;
|
|
495
|
+
this.options.info.session_start_limit.max_concurrency = info.session_start_limit.max_concurrency;
|
|
496
|
+
const spaces = WorkerManager.prepareSpaces({
|
|
497
|
+
shardsPerWorker: this.shardsPerWorker,
|
|
498
|
+
shardEnd: info.shards,
|
|
499
|
+
shardStart: 0,
|
|
500
|
+
}, this.debugger);
|
|
501
|
+
await this.prepareWorkers(spaces, true);
|
|
502
|
+
return this.reshardingWorkerQueue.shift()();
|
|
503
|
+
}, this.options.resharding.interval);
|
|
397
504
|
}
|
|
398
505
|
}
|
|
399
506
|
exports.WorkerManager = WorkerManager;
|
|
@@ -9,11 +9,10 @@ export declare class ConnectTimeout {
|
|
|
9
9
|
export declare class ConnectQueue {
|
|
10
10
|
intervalTime: number;
|
|
11
11
|
concurrency: number;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}[];
|
|
12
|
+
private queue;
|
|
13
|
+
private remaining;
|
|
15
14
|
protected interval?: NodeJS.Timeout;
|
|
16
15
|
constructor(intervalTime?: number, concurrency?: number);
|
|
17
|
-
push(callback: () =>
|
|
18
|
-
|
|
16
|
+
push(callback: () => unknown): unknown;
|
|
17
|
+
startInterval(): void;
|
|
19
18
|
}
|
|
@@ -32,41 +32,40 @@ class ConnectQueue {
|
|
|
32
32
|
intervalTime;
|
|
33
33
|
concurrency;
|
|
34
34
|
queue = [];
|
|
35
|
+
remaining = 0;
|
|
35
36
|
interval = undefined;
|
|
36
37
|
constructor(intervalTime = 5000, concurrency = 1) {
|
|
37
38
|
this.intervalTime = intervalTime;
|
|
38
39
|
this.concurrency = concurrency;
|
|
40
|
+
this.remaining = concurrency;
|
|
39
41
|
}
|
|
40
|
-
|
|
41
|
-
this.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
this.interval = setInterval(() => {
|
|
48
|
-
for (let i = 0; i < this.concurrency; i++) {
|
|
49
|
-
this.shift();
|
|
50
|
-
}
|
|
51
|
-
}, this.intervalTime);
|
|
42
|
+
push(callback) {
|
|
43
|
+
if (this.remaining === 0)
|
|
44
|
+
return this.queue.push(callback);
|
|
45
|
+
this.remaining--;
|
|
46
|
+
if (!this.interval) {
|
|
47
|
+
this.startInterval();
|
|
52
48
|
}
|
|
49
|
+
if (this.queue.length < this.concurrency) {
|
|
50
|
+
return callback();
|
|
51
|
+
}
|
|
52
|
+
return this.queue.push(callback);
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
startInterval() {
|
|
55
|
+
this.interval = setInterval(() => {
|
|
56
|
+
let cb;
|
|
57
|
+
while (this.queue.length && !(cb = this.queue.shift())) {
|
|
58
|
+
//
|
|
59
|
+
}
|
|
60
|
+
if (cb)
|
|
61
|
+
return cb?.();
|
|
62
|
+
if (this.remaining < this.concurrency)
|
|
63
|
+
return this.remaining++;
|
|
57
64
|
if (!this.queue.length) {
|
|
58
65
|
clearInterval(this.interval);
|
|
59
66
|
this.interval = undefined;
|
|
60
67
|
}
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
if (!shift.cb)
|
|
64
|
-
return this.shift();
|
|
65
|
-
await shift.cb?.();
|
|
66
|
-
if (!this.queue.length) {
|
|
67
|
-
clearInterval(this.interval);
|
|
68
|
-
this.interval = undefined;
|
|
69
|
-
}
|
|
68
|
+
}, this.intervalTime / this.concurrency);
|
|
70
69
|
}
|
|
71
70
|
}
|
|
72
71
|
exports.ConnectQueue = ConnectQueue;
|
package/package.json
CHANGED
|
@@ -1,70 +1,72 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "seyfert",
|
|
3
|
-
"version": "2.1.0",
|
|
4
|
-
"description": "The most advanced framework for discord bots",
|
|
5
|
-
"main": "./lib/index.js",
|
|
6
|
-
"module": "./lib/index.js",
|
|
7
|
-
"types": "./lib/index.d.ts",
|
|
8
|
-
"files": [
|
|
9
|
-
"lib/**"
|
|
10
|
-
],
|
|
11
|
-
"scripts": {
|
|
12
|
-
"build": "tsc --outDir ./lib",
|
|
13
|
-
"prepublishOnly": "npm run build",
|
|
14
|
-
"prepare": "npm run build && husky",
|
|
15
|
-
"lint": "biome lint --write ./src",
|
|
16
|
-
"format": "biome format --write ./src",
|
|
17
|
-
"check-h": "biome check --write ./src",
|
|
18
|
-
"check": "biome check --write --no-errors-on-unmatched ./src"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
"@
|
|
25
|
-
"@commitlint/
|
|
26
|
-
"@
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "seyfert",
|
|
3
|
+
"version": "2.1.1-dev-11316886063.0",
|
|
4
|
+
"description": "The most advanced framework for discord bots",
|
|
5
|
+
"main": "./lib/index.js",
|
|
6
|
+
"module": "./lib/index.js",
|
|
7
|
+
"types": "./lib/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"lib/**"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc --outDir ./lib",
|
|
13
|
+
"prepublishOnly": "npm run build",
|
|
14
|
+
"prepare": "npm run build && husky",
|
|
15
|
+
"lint": "biome lint --write ./src",
|
|
16
|
+
"format": "biome format --write ./src",
|
|
17
|
+
"check-h": "biome check --write ./src",
|
|
18
|
+
"check": "biome check --write --no-errors-on-unmatched ./src",
|
|
19
|
+
"test": "vitest run --config ./tests/vitest.config.mts ./tests/"
|
|
20
|
+
},
|
|
21
|
+
"author": "MARCROCK22",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@biomejs/biome": "1.9.3",
|
|
25
|
+
"@commitlint/cli": "^19.5.0",
|
|
26
|
+
"@commitlint/config-conventional": "^19.5.0",
|
|
27
|
+
"@types/node": "^22.7.4",
|
|
28
|
+
"husky": "^9.1.6",
|
|
29
|
+
"lint-staged": "^15.2.10",
|
|
30
|
+
"typescript": "^5.6.2",
|
|
31
|
+
"vitest": "^2.1.2"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://seyfert.dev",
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "git+https://github.com/tiramisulabs/seyfert.git"
|
|
37
|
+
},
|
|
38
|
+
"bugs": {
|
|
39
|
+
"url": "https://github.com/tiramisulabs/seyfert"
|
|
40
|
+
},
|
|
41
|
+
"keywords": [
|
|
42
|
+
"api",
|
|
43
|
+
"discord",
|
|
44
|
+
"bots",
|
|
45
|
+
"typescript",
|
|
46
|
+
"botdev"
|
|
47
|
+
],
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public"
|
|
50
|
+
},
|
|
51
|
+
"maintainers": [
|
|
52
|
+
{
|
|
53
|
+
"name": "socram03",
|
|
54
|
+
"url": "https://github.com/socram03"
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"contributors": [
|
|
58
|
+
{
|
|
59
|
+
"name": "Free 公園",
|
|
60
|
+
"url": "https://github.com/FreeAoi"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "David",
|
|
64
|
+
"url": "https://github.com/Drylozu"
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
"lint-staged": {
|
|
68
|
+
"*.ts": [
|
|
69
|
+
"biome check --write"
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { APIThreadChannel } from '../../types';
|
|
2
|
-
import type { ReturnCache } from '../..';
|
|
3
|
-
import { GuildRelatedResource } from './default/guild-related';
|
|
4
|
-
import { type ThreadChannelStructure } from '../../client/transformers';
|
|
5
|
-
export declare class Threads extends GuildRelatedResource<any, APIThreadChannel> {
|
|
6
|
-
namespace: string;
|
|
7
|
-
filter(data: APIThreadChannel, id: string, guild_id?: string): boolean;
|
|
8
|
-
get(id: string): ReturnCache<ThreadChannelStructure | undefined>;
|
|
9
|
-
raw(id: string): ReturnCache<APIThreadChannel | undefined>;
|
|
10
|
-
bulk(ids: string[]): ReturnCache<ThreadChannelStructure[]>;
|
|
11
|
-
bulkRaw(ids: string[]): ReturnCache<APIThreadChannel[]>;
|
|
12
|
-
values(guild: string): ReturnCache<ThreadChannelStructure[]>;
|
|
13
|
-
valuesRaw(guild: string): ReturnCache<APIThreadChannel[]>;
|
|
14
|
-
}
|