feat: expose filter method

This commit is contained in:
MARCROCK22 2024-09-07 22:35:04 +00:00
parent 364148ccf7
commit 0c7067f751
5 changed files with 5 additions and 5 deletions

View File

@ -23,7 +23,7 @@ export class CommandHandler extends BaseHandler {
values: (Command | ContextMenuCommand)[] = [];
entryPoint: EntryPointCommand | null = null;
protected filter = (path: string) => path.endsWith('.js') || (!path.endsWith('.d.ts') && path.endsWith('.ts'));
filter = (path: string) => path.endsWith('.js') || (!path.endsWith('.d.ts') && path.endsWith('.ts'));
constructor(
protected logger: Logger,

View File

@ -127,7 +127,7 @@ export class BaseHandler {
* @param path The path to filter.
* @returns `true` if the path passes the filter, otherwise `false`.
*/
protected filter = (path: string) => !!path;
filter = (path: string) => !!path;
/**
* Recursively retrieves all files in a directory.

View File

@ -27,7 +27,7 @@ export class ComponentHandler extends BaseHandler {
// 10 minutes timeout, because discord dont send an event when the user cancel the modal
readonly modals = new LimitedCollection<string, ModalSubmitCallback>({ expire: 60e3 * 10 });
readonly commands: ComponentCommands[] = [];
protected filter = (path: string) => path.endsWith('.js') || (!path.endsWith('.d.ts') && path.endsWith('.ts'));
filter = (path: string) => path.endsWith('.js') || (!path.endsWith('.d.ts') && path.endsWith('.ts'));
constructor(
logger: Logger,

View File

@ -54,7 +54,7 @@ export class EventHandler extends BaseHandler {
onFail = (event: GatewayEvents | CustomEventsKeys, err: unknown) =>
this.logger.warn('<Client>.events.onFail', err, event);
protected filter = (path: string) => path.endsWith('.js') || (!path.endsWith('.d.ts') && path.endsWith('.ts'));
filter = (path: string) => path.endsWith('.js') || (!path.endsWith('.d.ts') && path.endsWith('.ts'));
values: Partial<EventValues> = {};

View File

@ -6,7 +6,7 @@ import type { LocaleString, Locale } from '../types';
export class LangsHandler extends BaseHandler {
values: Partial<Record<string, any>> = {};
private __paths: Partial<Record<string, string>> = {};
protected filter = (path: string) =>
filter = (path: string) =>
path.endsWith('.js') || (!path.endsWith('.d.ts') && path.endsWith('.ts')) || path.endsWith('.json');
defaultLang?: string;
aliases: [string, LocaleString[]][] = [];