mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-04 14:06:07 +00:00
fix: defaultParsers in WorkerClient
This commit is contained in:
parent
ac0d09d77a
commit
7e30f4ba78
@ -32,7 +32,7 @@ import { PresenceUpdateHandler } from '../websocket/discord/events/presenceUpdat
|
|||||||
import type { BaseClientOptions, InternalRuntimeConfig, ServicesOptions, StartOptions } from './base';
|
import type { BaseClientOptions, InternalRuntimeConfig, ServicesOptions, StartOptions } from './base';
|
||||||
import { BaseClient } from './base';
|
import { BaseClient } from './base';
|
||||||
import { onInteractionCreate } from './oninteractioncreate';
|
import { onInteractionCreate } from './oninteractioncreate';
|
||||||
import { defaultArgsParser, defaultParseOptions, onMessageCreate } from './onmessagecreate';
|
import { defaultArgsParser, defaultOptionsParser, onMessageCreate } from './onmessagecreate';
|
||||||
import { Collectors } from './collectors';
|
import { Collectors } from './collectors';
|
||||||
|
|
||||||
let parentPort: import('node:worker_threads').MessagePort;
|
let parentPort: import('node:worker_threads').MessagePort;
|
||||||
@ -51,12 +51,15 @@ export class Client<Ready extends boolean = boolean> extends BaseClient {
|
|||||||
|
|
||||||
constructor(options?: ClientOptions) {
|
constructor(options?: ClientOptions) {
|
||||||
super(options);
|
super(options);
|
||||||
this.options = MergeOptions(this.options, {
|
this.options = MergeOptions(
|
||||||
commands: {
|
{
|
||||||
argsParser: options?.commands?.argsParser ?? defaultArgsParser,
|
commands: {
|
||||||
optionsParser: options?.commands?.optionsParser ?? defaultParseOptions,
|
argsParser: defaultArgsParser,
|
||||||
},
|
optionsParser: defaultOptionsParser,
|
||||||
} satisfies ClientOptions);
|
},
|
||||||
|
} satisfies ClientOptions,
|
||||||
|
this.options,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
setServices({
|
setServices({
|
||||||
|
@ -200,7 +200,7 @@ export async function onMessageCreate(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function defaultParseOptions(
|
export async function defaultOptionsParser(
|
||||||
self: UsingClient,
|
self: UsingClient,
|
||||||
command: Command | SubCommand,
|
command: Command | SubCommand,
|
||||||
message: GatewayMessageCreateDispatchData,
|
message: GatewayMessageCreateDispatchData,
|
||||||
|
@ -3,7 +3,7 @@ import { randomUUID } from 'node:crypto';
|
|||||||
import { ApiHandler, Logger } from '..';
|
import { ApiHandler, Logger } from '..';
|
||||||
import type { Cache } from '../cache';
|
import type { Cache } from '../cache';
|
||||||
import { WorkerAdapter } from '../cache';
|
import { WorkerAdapter } from '../cache';
|
||||||
import { LogLevels, lazyLoadPackage, type DeepPartial, type When } from '../common';
|
import { LogLevels, MergeOptions, lazyLoadPackage, type DeepPartial, type When } from '../common';
|
||||||
import { EventHandler } from '../events';
|
import { EventHandler } from '../events';
|
||||||
import { ClientUser } from '../structures';
|
import { ClientUser } from '../structures';
|
||||||
import { Shard, type ShardManagerOptions, type WorkerData } from '../websocket';
|
import { Shard, type ShardManagerOptions, type WorkerData } from '../websocket';
|
||||||
@ -24,7 +24,7 @@ import type { BaseClientOptions, ServicesOptions, StartOptions } from './base';
|
|||||||
import { BaseClient } from './base';
|
import { BaseClient } from './base';
|
||||||
import type { Client } from './client';
|
import type { Client } from './client';
|
||||||
import { onInteractionCreate } from './oninteractioncreate';
|
import { onInteractionCreate } from './oninteractioncreate';
|
||||||
import { onMessageCreate } from './onmessagecreate';
|
import { defaultArgsParser, defaultOptionsParser, onMessageCreate } from './onmessagecreate';
|
||||||
import { Collectors } from './collectors';
|
import { Collectors } from './collectors';
|
||||||
|
|
||||||
let workerData: WorkerData;
|
let workerData: WorkerData;
|
||||||
@ -58,6 +58,15 @@ export class WorkerClient<Ready extends boolean = boolean> extends BaseClient {
|
|||||||
|
|
||||||
constructor(options?: WorkerClientOptions) {
|
constructor(options?: WorkerClientOptions) {
|
||||||
super(options);
|
super(options);
|
||||||
|
this.options = MergeOptions(
|
||||||
|
{
|
||||||
|
commands: {
|
||||||
|
argsParser: defaultArgsParser,
|
||||||
|
optionsParser: defaultOptionsParser,
|
||||||
|
},
|
||||||
|
} satisfies Partial<WorkerClientOptions>,
|
||||||
|
this.options,
|
||||||
|
);
|
||||||
if (!process.env.SEYFERT_SPAWNING) {
|
if (!process.env.SEYFERT_SPAWNING) {
|
||||||
throw new Error('WorkerClient cannot spawn without manager');
|
throw new Error('WorkerClient cannot spawn without manager');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user