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