fix: unused

This commit is contained in:
MARCROCK22 2024-09-07 22:29:06 +00:00
parent 7c70f362fb
commit 364148ccf7
3 changed files with 2 additions and 63 deletions

View File

@ -188,7 +188,7 @@ export class BaseClient {
return new Router(this.rest).createProxy(); return new Router(this.rest).createProxy();
} }
setServices({ rest, cache, langs, middlewares, handlers, handleCommand }: ServicesOptions) { setServices({ rest, cache, langs, middlewares, handleCommand }: ServicesOptions) {
if (rest) { if (rest) {
this.rest = rest; this.rest = rest;
} }
@ -234,35 +234,6 @@ export class BaseClient {
if (middlewares) { if (middlewares) {
this.middlewares = middlewares; this.middlewares = middlewares;
} }
if (handlers) {
if ('components' in handlers) {
if (!handlers.components) {
this.components = undefined;
} else if (typeof handlers.components === 'function') {
this.components ??= new ComponentHandler(this.logger, this);
} else {
this.components = handlers.components;
}
}
if ('commands' in handlers) {
if (!handlers.commands) {
this.commands = undefined;
} else if (typeof handlers.commands === 'object') {
this.commands ??= new CommandHandler(this.logger, this);
} else {
this.commands = handlers.commands;
}
}
if ('langs' in handlers) {
if (!handlers.langs) {
this.langs = undefined;
} else if (typeof handlers.langs === 'function') {
this.langs ??= new LangsHandler(this.logger);
} else {
this.langs = handlers.langs;
}
}
}
if (langs) { if (langs) {
if (langs.default) this.langs!.defaultLang = langs.default; if (langs.default) this.langs!.defaultLang = langs.default;
if (langs.aliases) this.langs!.aliases = Object.entries(langs.aliases); if (langs.aliases) this.langs!.aliases = Object.entries(langs.aliases);
@ -565,10 +536,5 @@ export interface ServicesOptions {
aliases?: Record<string, LocaleString[]>; aliases?: Record<string, LocaleString[]>;
}; };
middlewares?: Record<string, MiddlewareContext>; middlewares?: Record<string, MiddlewareContext>;
handlers?: {
components?: ComponentHandler | ComponentHandler['callback'];
commands?: CommandHandler;
langs?: LangsHandler;
};
handleCommand?: typeof HandleCommand; handleCommand?: typeof HandleCommand;
} }

View File

@ -40,9 +40,6 @@ export class Client<Ready extends boolean = boolean> extends BaseClient {
...rest ...rest
}: ServicesOptions & { }: ServicesOptions & {
gateway?: ShardManager; gateway?: ShardManager;
handlers?: ServicesOptions['handlers'] & {
events?: EventHandler['callback'];
};
}) { }) {
super.setServices(rest); super.setServices(rest);
if (gateway) { if (gateway) {
@ -54,15 +51,6 @@ export class Client<Ready extends boolean = boolean> extends BaseClient {
}; };
this.gateway = gateway; this.gateway = gateway;
} }
if (rest.handlers && 'events' in rest.handlers) {
if (!rest.handlers.events) {
this.events = undefined;
} else if (typeof rest.handlers.events === 'function') {
this.events = new EventHandler(this);
} else {
this.events = rest.handlers.events;
}
}
} }
async loadEvents(dir?: string) { async loadEvents(dir?: string) {

View File

@ -78,26 +78,11 @@ export class WorkerClient<Ready extends boolean = boolean> extends BaseClient {
return acc / this.shards.size; return acc / this.shards.size;
} }
setServices({ setServices(rest: ServicesOptions) {
...rest
}: ServicesOptions & {
handlers?: ServicesOptions['handlers'] & {
events?: EventHandler['callback'];
};
}) {
super.setServices(rest); super.setServices(rest);
if (rest.cache) { if (rest.cache) {
this.__setServicesCache = true; this.__setServicesCache = true;
} }
if (rest.handlers && 'events' in rest.handlers) {
if (!rest.handlers.events) {
this.events = undefined;
} else if (typeof rest.handlers.events === 'function') {
this.events = new EventHandler(this);
} else {
this.events = rest.handlers.events;
}
}
} }
setWorkerData(data: WorkerData) { setWorkerData(data: WorkerData) {