seyfert 1.3.2 → 1.4.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/api.js +13 -7
- package/lib/builders/Attachment.d.ts +1 -4
- package/lib/builders/Attachment.js +4 -4
- package/lib/cache/adapters/workeradapter.js +7 -3
- package/lib/cache/resources/default/base.d.ts +1 -2
- package/lib/cache/resources/default/guild-based.d.ts +1 -2
- package/lib/client/base.d.ts +26 -4
- package/lib/client/base.js +42 -2
- package/lib/client/client.d.ts +3 -3
- package/lib/client/client.js +18 -6
- package/lib/client/httpclient.d.ts +7 -8
- package/lib/client/httpclient.js +92 -13
- package/lib/client/oninteractioncreate.d.ts +2 -2
- package/lib/client/oninteractioncreate.js +15 -7
- package/lib/client/onmessagecreate.js +74 -66
- package/lib/client/workerclient.d.ts +1 -1
- package/lib/client/workerclient.js +18 -7
- package/lib/commands/applications/chat.d.ts +1 -1
- package/lib/commands/applications/chat.js +2 -1
- package/lib/commands/applications/chatcontext.d.ts +1 -1
- package/lib/commands/applications/chatcontext.js +2 -2
- package/lib/commands/applications/menu.js +0 -48
- package/lib/commands/applications/menucontext.d.ts +1 -1
- package/lib/commands/applications/menucontext.js +3 -3
- package/lib/commands/applications/options.d.ts +3 -1
- package/lib/commands/basecontext.d.ts +26 -0
- package/lib/commands/{basecontex.js → basecontext.js} +24 -0
- package/lib/commands/handler.d.ts +6 -1
- package/lib/commands/handler.js +125 -3
- package/lib/common/bot/watcher.d.ts +1 -2
- package/lib/common/bot/watcher.js +9 -4
- package/lib/common/it/logger.d.ts +1 -1
- package/lib/common/it/logger.js +9 -8
- package/lib/common/it/utils.d.ts +2 -0
- package/lib/common/it/utils.js +19 -5
- package/lib/common/shorters/interaction.js +6 -4
- package/lib/common/shorters/messages.js +2 -2
- package/lib/common/shorters/webhook.js +2 -2
- package/lib/components/componentcommand.d.ts +21 -0
- package/lib/components/{command.js → componentcommand.js} +2 -5
- package/lib/components/componentcontext.d.ts +20 -16
- package/lib/components/componentcontext.js +27 -9
- package/lib/components/handler.d.ts +10 -5
- package/lib/components/handler.js +94 -17
- package/lib/components/index.d.ts +3 -1
- package/lib/components/index.js +3 -1
- package/lib/components/modalcommand.d.ts +15 -0
- package/lib/components/modalcommand.js +9 -0
- package/lib/components/modalcontext.d.ts +104 -0
- package/lib/components/modalcontext.js +132 -0
- package/lib/events/handler.d.ts +4 -1
- package/lib/events/handler.js +2 -7
- package/lib/events/hooks/application_command.d.ts +2 -2
- package/lib/events/hooks/auto_moderation.d.ts +5 -5
- package/lib/events/hooks/channel.d.ts +5 -5
- package/lib/events/hooks/custom.d.ts +3 -3
- package/lib/events/hooks/dispatch.d.ts +4 -4
- package/lib/events/hooks/entitlement.d.ts +7 -4
- package/lib/events/hooks/guild.d.ts +57 -23
- package/lib/events/hooks/guild.js +6 -6
- package/lib/events/hooks/integration.d.ts +4 -4
- package/lib/events/hooks/interactions.d.ts +2 -2
- package/lib/events/hooks/invite.d.ts +3 -3
- package/lib/events/hooks/message.d.ts +13 -13
- package/lib/events/hooks/message.js +1 -1
- package/lib/events/hooks/presence.d.ts +7 -3
- package/lib/events/hooks/presence.js +2 -2
- package/lib/events/hooks/stage.d.ts +7 -13
- package/lib/events/hooks/stage.js +2 -2
- package/lib/events/hooks/thread.d.ts +7 -7
- package/lib/events/hooks/thread.js +2 -2
- package/lib/events/hooks/typing.d.ts +2 -2
- package/lib/events/hooks/user.d.ts +2 -2
- package/lib/events/hooks/user.js +2 -2
- package/lib/events/hooks/voice.d.ts +5 -45
- package/lib/events/hooks/voice.js +4 -7
- package/lib/events/hooks/webhook.d.ts +2 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +9 -4
- package/lib/langs/handler.d.ts +4 -1
- package/lib/langs/handler.js +3 -3
- package/lib/structures/Interaction.d.ts +3 -3
- package/lib/structures/Interaction.js +14 -7
- package/lib/structures/Message.d.ts +2 -2
- package/lib/structures/Message.js +11 -2
- package/lib/structures/VoiceState.d.ts +6 -5
- package/lib/structures/VoiceState.js +6 -3
- package/lib/structures/channels.d.ts +1 -1
- package/lib/structures/channels.js +2 -1
- package/lib/websocket/discord/sharder.js +10 -3
- package/lib/websocket/discord/shared.d.ts +1 -0
- package/lib/websocket/discord/workermanager.d.ts +2 -3
- package/lib/websocket/discord/workermanager.js +4 -2
- package/package.json +3 -3
- package/lib/commands/basecontex.d.ts +0 -15
- package/lib/components/command.d.ts +0 -24
package/lib/langs/handler.js
CHANGED
|
@@ -30,10 +30,10 @@ class LangsHandler extends common_1.BaseHandler {
|
|
|
30
30
|
const locale = this.getLocale(userLocale);
|
|
31
31
|
return (0, router_1.LangRouter)(locale, this.defaultLang ?? locale, this.values)();
|
|
32
32
|
}
|
|
33
|
-
async load(dir) {
|
|
34
|
-
const files = await this.loadFilesK(await this.getFiles(dir));
|
|
33
|
+
async load(dir, instances) {
|
|
34
|
+
const files = instances ?? (await this.loadFilesK(await this.getFiles(dir)));
|
|
35
35
|
for (const i of files) {
|
|
36
|
-
const locale = i.name.split('.').slice(0, -1).join('.');
|
|
36
|
+
const locale = i.name.split('.').slice(0, -1).join('.') || i.name;
|
|
37
37
|
const result = this.callback(locale, i.file);
|
|
38
38
|
if (result)
|
|
39
39
|
this.values[locale] = result;
|
|
@@ -27,8 +27,8 @@ export declare class BaseInteraction<FromGuild extends boolean = boolean, Type e
|
|
|
27
27
|
replied?: Promise<boolean> | boolean;
|
|
28
28
|
appPermissions?: PermissionsBitField;
|
|
29
29
|
constructor(client: UsingClient, interaction: Type, __reply?: __InternalReplyFunction | undefined);
|
|
30
|
-
static transformBodyRequest(body: ReplyInteractionBody): APIInteractionResponse;
|
|
31
|
-
static transformBody<T>(body: InteractionMessageUpdateBodyRequest | MessageUpdateBodyRequest | MessageCreateBodyRequest | MessageWebhookCreateBodyRequest): T;
|
|
30
|
+
static transformBodyRequest(body: ReplyInteractionBody, self: UsingClient): APIInteractionResponse;
|
|
31
|
+
static transformBody<T>(body: InteractionMessageUpdateBodyRequest | MessageUpdateBodyRequest | MessageCreateBodyRequest | MessageWebhookCreateBodyRequest, self: UsingClient): T;
|
|
32
32
|
private matchReplied;
|
|
33
33
|
reply(body: ReplyInteractionBody): Promise<void>;
|
|
34
34
|
deferReply(flags?: MessageFlags): Promise<void>;
|
|
@@ -43,7 +43,7 @@ export declare class AutocompleteInteraction<FromGuild extends boolean = boolean
|
|
|
43
43
|
type: InteractionType.ApplicationCommandAutocomplete;
|
|
44
44
|
data: ObjectToLower<APIApplicationCommandAutocompleteInteraction['data']>;
|
|
45
45
|
options: OptionResolver;
|
|
46
|
-
constructor(client: UsingClient, interaction: APIApplicationCommandAutocompleteInteraction, __reply?: __InternalReplyFunction | undefined);
|
|
46
|
+
constructor(client: UsingClient, interaction: APIApplicationCommandAutocompleteInteraction, resolver?: OptionResolver, __reply?: __InternalReplyFunction | undefined);
|
|
47
47
|
getInput(): string;
|
|
48
48
|
respond(choices: APICommandAutocompleteInteractionResponseCallbackData['choices']): Promise<void>;
|
|
49
49
|
/** @intenal */
|
|
@@ -48,7 +48,7 @@ class BaseInteraction extends DiscordBase_1.DiscordBase {
|
|
|
48
48
|
}
|
|
49
49
|
this.user = this.member?.user ?? new User_1.User(client, interaction.user);
|
|
50
50
|
}
|
|
51
|
-
static transformBodyRequest(body) {
|
|
51
|
+
static transformBodyRequest(body, self) {
|
|
52
52
|
switch (body.type) {
|
|
53
53
|
case v10_1.InteractionResponseType.ApplicationCommandAutocompleteResult:
|
|
54
54
|
case v10_1.InteractionResponseType.DeferredMessageUpdate:
|
|
@@ -61,6 +61,8 @@ class BaseInteraction extends DiscordBase_1.DiscordBase {
|
|
|
61
61
|
type: body.type,
|
|
62
62
|
//@ts-ignore
|
|
63
63
|
data: {
|
|
64
|
+
//@ts-ignore
|
|
65
|
+
allowed_mentions: self.options?.allowedMentions,
|
|
64
66
|
...(body.data ?? {}),
|
|
65
67
|
//@ts-ignore
|
|
66
68
|
components: body.data?.components?.map(x => (x instanceof builders_1.ActionRow ? x.toJSON() : x)) ?? undefined,
|
|
@@ -88,9 +90,10 @@ class BaseInteraction extends DiscordBase_1.DiscordBase {
|
|
|
88
90
|
return body;
|
|
89
91
|
}
|
|
90
92
|
}
|
|
91
|
-
static transformBody(body) {
|
|
93
|
+
static transformBody(body, self) {
|
|
92
94
|
const poll = body.poll;
|
|
93
95
|
return {
|
|
96
|
+
allowed_mentions: self.options?.allowedMentions,
|
|
94
97
|
...body,
|
|
95
98
|
components: body.components?.map(x => (x instanceof builders_1.ActionRow ? x.toJSON() : x)) ?? undefined,
|
|
96
99
|
embeds: body?.embeds?.map(x => (x instanceof builders_1.Embed ? x.toJSON() : x)) ?? undefined,
|
|
@@ -100,9 +103,11 @@ class BaseInteraction extends DiscordBase_1.DiscordBase {
|
|
|
100
103
|
async matchReplied(body) {
|
|
101
104
|
if (this.__reply) {
|
|
102
105
|
//@ts-expect-error
|
|
103
|
-
const { files, ...
|
|
106
|
+
const { files, ...rest } = body.data ?? {};
|
|
107
|
+
//@ts-expect-error
|
|
108
|
+
const data = body.data instanceof builders_1.Modal ? body.data : rest;
|
|
104
109
|
return (this.replied = this.__reply({
|
|
105
|
-
body: BaseInteraction.transformBodyRequest({ data, type: body.type }),
|
|
110
|
+
body: BaseInteraction.transformBodyRequest({ data, type: body.type }, this.client),
|
|
106
111
|
files: files ? await (0, builders_1.resolveFiles)(files) : undefined,
|
|
107
112
|
}).then(() => (this.replied = true)));
|
|
108
113
|
}
|
|
@@ -129,7 +134,7 @@ class BaseInteraction extends DiscordBase_1.DiscordBase {
|
|
|
129
134
|
static from(client, gateway, __reply) {
|
|
130
135
|
switch (gateway.type) {
|
|
131
136
|
case v10_1.InteractionType.ApplicationCommandAutocomplete:
|
|
132
|
-
return new AutocompleteInteraction(client, gateway, __reply);
|
|
137
|
+
return new AutocompleteInteraction(client, gateway, undefined, __reply);
|
|
133
138
|
// biome-ignore lint/suspicious/noFallthroughSwitchClause: bad interaction between biome and ts-server
|
|
134
139
|
case v10_1.InteractionType.ApplicationCommand:
|
|
135
140
|
switch (gateway.data.type) {
|
|
@@ -170,10 +175,12 @@ exports.BaseInteraction = BaseInteraction;
|
|
|
170
175
|
class AutocompleteInteraction extends BaseInteraction {
|
|
171
176
|
__reply;
|
|
172
177
|
options;
|
|
173
|
-
constructor(client, interaction, __reply) {
|
|
178
|
+
constructor(client, interaction, resolver, __reply) {
|
|
174
179
|
super(client, interaction);
|
|
175
180
|
this.__reply = __reply;
|
|
176
|
-
this.options =
|
|
181
|
+
this.options =
|
|
182
|
+
resolver ??
|
|
183
|
+
new commands_1.OptionResolver(client, interaction.data.options, undefined, interaction.guild_id, interaction.data.resolved);
|
|
177
184
|
}
|
|
178
185
|
getInput() {
|
|
179
186
|
return this.options.getAutocompleteValue() ?? '';
|
|
@@ -49,8 +49,8 @@ export declare class Message extends BaseMessage {
|
|
|
49
49
|
delete(reason?: string): Promise<void>;
|
|
50
50
|
crosspost(reason?: string): Promise<Message>;
|
|
51
51
|
}
|
|
52
|
-
export type EditMessageWebhook = Omit<MessageWebhookMethodEditParams, 'messageId'>;
|
|
53
|
-
export type WriteMessageWebhook = MessageWebhookMethodWriteParams
|
|
52
|
+
export type EditMessageWebhook = Omit<MessageWebhookMethodEditParams, 'messageId'>['body'] & Pick<MessageWebhookMethodEditParams, 'query'>;
|
|
53
|
+
export type WriteMessageWebhook = MessageWebhookMethodWriteParams['body'] & Pick<MessageWebhookMethodWriteParams, 'query'>;
|
|
54
54
|
export declare class WebhookMessage extends BaseMessage {
|
|
55
55
|
readonly webhookId: string;
|
|
56
56
|
readonly webhookToken: string;
|
|
@@ -122,10 +122,19 @@ class WebhookMessage extends BaseMessage {
|
|
|
122
122
|
return this.api.webhooks(this.webhookId)(this.webhookToken).get({ query: this.thread?.id });
|
|
123
123
|
}
|
|
124
124
|
edit(body) {
|
|
125
|
-
|
|
125
|
+
const { query, ...rest } = body;
|
|
126
|
+
return this.client.webhooks.editMessage(this.webhookId, this.webhookToken, {
|
|
127
|
+
body: rest,
|
|
128
|
+
query,
|
|
129
|
+
messageId: this.id,
|
|
130
|
+
});
|
|
126
131
|
}
|
|
127
132
|
write(body) {
|
|
128
|
-
|
|
133
|
+
const { query, ...rest } = body;
|
|
134
|
+
return this.client.webhooks.writeMessage(this.webhookId, this.webhookToken, {
|
|
135
|
+
body: rest,
|
|
136
|
+
query,
|
|
137
|
+
});
|
|
129
138
|
}
|
|
130
139
|
delete(reason) {
|
|
131
140
|
return this.client.webhooks.deleteMessage(this.webhookId, this.webhookToken, this.id, reason);
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { GuildMember, type UsingClient } from '../';
|
|
2
2
|
import type { VoiceStateResource } from '../cache/resources/voice-states';
|
|
3
3
|
import type { ObjectToLower } from '../common';
|
|
4
|
+
import type { GatewayVoiceState } from '../types';
|
|
4
5
|
import { Base } from './extra/Base';
|
|
5
|
-
export interface VoiceState extends Base, ObjectToLower<VoiceStateResource
|
|
6
|
+
export interface VoiceState extends Base, ObjectToLower<Omit<VoiceStateResource, 'member'>> {
|
|
6
7
|
}
|
|
7
8
|
export declare class VoiceState extends Base {
|
|
8
|
-
|
|
9
|
-
constructor(client: UsingClient, data:
|
|
9
|
+
protected withMember?: GuildMember;
|
|
10
|
+
constructor(client: UsingClient, data: GatewayVoiceState);
|
|
10
11
|
isMuted(): boolean;
|
|
11
12
|
member(force?: boolean): Promise<GuildMember>;
|
|
12
13
|
user(force?: boolean): Promise<import("./User").User>;
|
|
13
|
-
channel(force?: boolean): Promise<import("./channels").BaseChannel<import("discord-api-types/v10").ChannelType> | import("./channels").DMChannel | import("./channels").CategoryChannel | undefined>;
|
|
14
|
+
channel(force?: boolean): Promise<import("./channels").BaseChannel<import("discord-api-types/payloads/v10/channel").ChannelType> | import("./channels").DMChannel | import("./channels").CategoryChannel | undefined>;
|
|
14
15
|
setMute(mute?: boolean, reason?: string): Promise<GuildMember>;
|
|
15
16
|
setDeaf(deaf?: boolean, reason?: string): Promise<GuildMember>;
|
|
16
17
|
disconnect(reason?: string): Promise<GuildMember>;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VoiceState = void 0;
|
|
4
|
+
const __1 = require("../");
|
|
4
5
|
const Base_1 = require("./extra/Base");
|
|
5
6
|
class VoiceState extends Base_1.Base {
|
|
6
7
|
withMember;
|
|
7
|
-
constructor(client, data
|
|
8
|
+
constructor(client, data) {
|
|
8
9
|
super(client);
|
|
9
|
-
|
|
10
|
-
this.__patchThis(
|
|
10
|
+
const { member, ...rest } = data;
|
|
11
|
+
this.__patchThis(rest);
|
|
12
|
+
if (member?.user && data.guild_id)
|
|
13
|
+
this.withMember = new __1.GuildMember(client, member, member.user, data.guild_id);
|
|
11
14
|
}
|
|
12
15
|
isMuted() {
|
|
13
16
|
return this.mute || this.selfMute;
|
|
@@ -153,7 +153,7 @@ export declare class MessagesMethods extends DiscordBase {
|
|
|
153
153
|
set: (messageId: string, reason?: string) => Promise<never>;
|
|
154
154
|
delete: (messageId: string, reason?: string) => Promise<never>;
|
|
155
155
|
};
|
|
156
|
-
static transformMessageBody<T>(body: MessageCreateBodyRequest | MessageUpdateBodyRequest): T;
|
|
156
|
+
static transformMessageBody<T>(body: MessageCreateBodyRequest | MessageUpdateBodyRequest, self: UsingClient): T;
|
|
157
157
|
}
|
|
158
158
|
export interface TextBaseGuildChannel extends ObjectToLower<Omit<APITextChannel, 'type' | 'permission_overwrites'>>, MessagesMethods {
|
|
159
159
|
}
|
|
@@ -159,9 +159,10 @@ class MessagesMethods extends DiscordBase_1.DiscordBase {
|
|
|
159
159
|
delete: (messageId, reason) => ctx.client.channels.deletePin(messageId, ctx.channelId, reason),
|
|
160
160
|
};
|
|
161
161
|
}
|
|
162
|
-
static transformMessageBody(body) {
|
|
162
|
+
static transformMessageBody(body, self) {
|
|
163
163
|
const poll = body.poll;
|
|
164
164
|
return {
|
|
165
|
+
allowed_mentions: self.options?.allowedMentions,
|
|
165
166
|
...body,
|
|
166
167
|
components: body.components?.map(x => (x instanceof builders_1.ActionRow ? x.toJSON() : x)) ?? undefined,
|
|
167
168
|
embeds: body.embeds?.map(x => (x instanceof builders_1.Embed ? x.toJSON() : x)) ?? undefined,
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ShardManager = void 0;
|
|
4
4
|
const v10_1 = require("discord-api-types/v10");
|
|
5
|
-
const node_worker_threads_1 = require("node:worker_threads");
|
|
6
5
|
const common_1 = require("../../common");
|
|
7
6
|
const constants_1 = require("../constants");
|
|
8
7
|
const structures_1 = require("../structures");
|
|
9
8
|
const timeout_1 = require("../structures/timeout");
|
|
10
9
|
const shard_js_1 = require("./shard.js");
|
|
10
|
+
let parentPort;
|
|
11
|
+
let workerData;
|
|
11
12
|
class ShardManager extends Map {
|
|
12
13
|
connectQueue;
|
|
13
14
|
options;
|
|
@@ -23,6 +24,12 @@ class ShardManager extends Map {
|
|
|
23
24
|
logLevel: common_1.LogLevels.Debug,
|
|
24
25
|
});
|
|
25
26
|
}
|
|
27
|
+
const worker_threads = (0, common_1.lazyLoadPackage)('node:worker_threads');
|
|
28
|
+
if (worker_threads) {
|
|
29
|
+
workerData = worker_threads.workerData;
|
|
30
|
+
if (worker_threads.parentPort)
|
|
31
|
+
parentPort = worker_threads.parentPort;
|
|
32
|
+
}
|
|
26
33
|
}
|
|
27
34
|
get totalShards() {
|
|
28
35
|
return this.options.totalShards ?? this.options.info.shards;
|
|
@@ -148,8 +155,8 @@ class ShardManager extends Map {
|
|
|
148
155
|
});
|
|
149
156
|
}
|
|
150
157
|
send(shardId, payload) {
|
|
151
|
-
if (
|
|
152
|
-
return
|
|
158
|
+
if (workerData?.__USING_WATCHER__) {
|
|
159
|
+
return parentPort?.postMessage({
|
|
153
160
|
type: 'SEND_TO_SHARD',
|
|
154
161
|
shardId,
|
|
155
162
|
payload,
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
/// <reference types="node" />
|
|
8
8
|
import type { GatewayPresenceUpdateData, GatewaySendPayload } from 'discord-api-types/v10';
|
|
9
9
|
import { type Worker as ClusterWorker } from 'node:cluster';
|
|
10
|
-
import { Worker as ThreadWorker } from 'node:worker_threads';
|
|
11
10
|
import { ApiHandler, Logger } from '../..';
|
|
12
11
|
import { type Adapter } from '../../cache';
|
|
13
12
|
import { type MakePartial } from '../../common';
|
|
@@ -16,7 +15,7 @@ import { MemberUpdateHandler } from './events/memberUpdate';
|
|
|
16
15
|
import { PresenceUpdateHandler } from './events/presenceUpdate';
|
|
17
16
|
import type { ShardOptions, WorkerData, WorkerManagerOptions } from './shared';
|
|
18
17
|
import type { WorkerInfo, WorkerMessage, WorkerShardInfo } from './worker';
|
|
19
|
-
export declare class WorkerManager extends Map<number, (ClusterWorker |
|
|
18
|
+
export declare class WorkerManager extends Map<number, (ClusterWorker | import('node:worker_threads').Worker) & {
|
|
20
19
|
ready?: boolean;
|
|
21
20
|
}> {
|
|
22
21
|
options: Required<WorkerManagerOptions>;
|
|
@@ -50,7 +49,7 @@ export declare class WorkerManager extends Map<number, (ClusterWorker | ThreadWo
|
|
|
50
49
|
prepareSpaces(): number[][];
|
|
51
50
|
postMessage(id: number, body: any): void;
|
|
52
51
|
prepareWorkers(shards: number[][]): Promise<void>;
|
|
53
|
-
createWorker(workerData: WorkerData): ClusterWorker |
|
|
52
|
+
createWorker(workerData: WorkerData): ClusterWorker | import("worker_threads").Worker;
|
|
54
53
|
spawn(workerId: number, shardId: number): void;
|
|
55
54
|
handleWorkerMessage(message: WorkerMessage): Promise<void>;
|
|
56
55
|
private generateNonce;
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.WorkerManager = void 0;
|
|
7
7
|
const node_cluster_1 = __importDefault(require("node:cluster"));
|
|
8
8
|
const node_crypto_1 = require("node:crypto");
|
|
9
|
-
const node_worker_threads_1 = require("node:worker_threads");
|
|
10
9
|
const __1 = require("../..");
|
|
11
10
|
const cache_1 = require("../../cache");
|
|
12
11
|
const base_1 = require("../../client/base");
|
|
@@ -139,6 +138,9 @@ class WorkerManager extends Map {
|
|
|
139
138
|
}
|
|
140
139
|
}
|
|
141
140
|
createWorker(workerData) {
|
|
141
|
+
const worker_threads = (0, common_1.lazyLoadPackage)('node:worker_threads');
|
|
142
|
+
if (!worker_threads)
|
|
143
|
+
throw new Error('Cannot create worker without worker_threads.');
|
|
142
144
|
const env = {
|
|
143
145
|
SEYFERT_SPAWNING: 'true',
|
|
144
146
|
};
|
|
@@ -147,7 +149,7 @@ class WorkerManager extends Map {
|
|
|
147
149
|
}
|
|
148
150
|
switch (this.options.mode) {
|
|
149
151
|
case 'threads': {
|
|
150
|
-
const worker = new
|
|
152
|
+
const worker = new worker_threads.Worker(workerData.path, {
|
|
151
153
|
env,
|
|
152
154
|
});
|
|
153
155
|
worker.on('message', data => this.handleWorkerMessage(data));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "seyfert",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "The most advanced framework for discord bots",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"module": "./lib/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"chokidar": "^3.6.0",
|
|
24
|
-
"discord-api-types": "^0.37.
|
|
24
|
+
"discord-api-types": "^0.37.83",
|
|
25
25
|
"magic-bytes.js": "^1.10.0",
|
|
26
26
|
"ts-mixer": "^6.0.4",
|
|
27
27
|
"ws": "^8.16.0"
|
|
@@ -71,4 +71,4 @@
|
|
|
71
71
|
"url": "https://github.com/socram03"
|
|
72
72
|
}
|
|
73
73
|
]
|
|
74
|
-
}
|
|
74
|
+
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { ComponentCommandInteractionMap, ComponentContext } from '../components/componentcontext';
|
|
2
|
-
import type { MessageCommandInteraction, UserCommandInteraction } from '../structures';
|
|
3
|
-
import type { CommandContext } from './applications/chatcontext';
|
|
4
|
-
import type { MenuCommandContext } from './applications/menucontext';
|
|
5
|
-
import type { UsingClient } from './applications/shared';
|
|
6
|
-
export declare class BaseContext {
|
|
7
|
-
readonly client: UsingClient;
|
|
8
|
-
constructor(client: UsingClient);
|
|
9
|
-
get proxy(): import("..").APIRoutes;
|
|
10
|
-
isChat(): this is CommandContext;
|
|
11
|
-
isMenu(): this is MenuCommandContext<UserCommandInteraction | MessageCommandInteraction>;
|
|
12
|
-
isMenuUser(): this is MenuCommandContext<UserCommandInteraction>;
|
|
13
|
-
isMenuMessage(): this is MenuCommandContext<MessageCommandInteraction>;
|
|
14
|
-
isComponent(): this is ComponentContext<keyof ComponentCommandInteractionMap>;
|
|
15
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { ModalSubmitInteraction } from '../structures';
|
|
2
|
-
import type { ComponentCommandInteractionMap, ComponentContext } from './componentcontext';
|
|
3
|
-
export declare const InteractionCommandType: {
|
|
4
|
-
readonly COMPONENT: 0;
|
|
5
|
-
readonly MODAL: 1;
|
|
6
|
-
};
|
|
7
|
-
export interface ComponentCommand {
|
|
8
|
-
__filePath?: string;
|
|
9
|
-
}
|
|
10
|
-
export declare abstract class ComponentCommand {
|
|
11
|
-
type: 0;
|
|
12
|
-
abstract componentType: keyof ComponentCommandInteractionMap;
|
|
13
|
-
abstract filter(interaction: ComponentContext<typeof this.componentType>): Promise<boolean> | boolean;
|
|
14
|
-
abstract run(interaction: ComponentContext<typeof this.componentType>): any;
|
|
15
|
-
get cType(): number;
|
|
16
|
-
}
|
|
17
|
-
export interface ModalCommand {
|
|
18
|
-
__filePath?: string;
|
|
19
|
-
}
|
|
20
|
-
export declare abstract class ModalCommand {
|
|
21
|
-
type: 1;
|
|
22
|
-
abstract filter(interaction: ModalSubmitInteraction): Promise<boolean> | boolean;
|
|
23
|
-
abstract run(interaction: ModalSubmitInteraction): any;
|
|
24
|
-
}
|