diff --git a/src/client/components/observers/Automoderation.ts b/src/client/components/observers/Automoderation.ts index f850e6c..5c7cf65 100644 --- a/src/client/components/observers/Automoderation.ts +++ b/src/client/components/observers/Automoderation.ts @@ -85,7 +85,7 @@ export default class AutoModeration extends Observer implements Initialisable // Fetch a list of TLDs from iana const tldList = await this.client.managerEval(` (() => { - return ClientUtils.fetchTlds() + return this.clientUtils.fetchTlds(); })() `).catch(this.logger.error.bind(this.logger)) as string[] | undefined; diff --git a/src/client/interfaces/CommandOption.ts b/src/client/interfaces/CommandOption.ts index 6a9b8f2..52f75c5 100644 --- a/src/client/interfaces/CommandOption.ts +++ b/src/client/interfaces/CommandOption.ts @@ -101,7 +101,8 @@ class CommandOption this.#minimum = options.minimum; if (typeof options.maximum === 'number') this.#maximum = options.maximum; - if (typeof this.#maximum === 'undefined' || this.#maximum > Number.MAX_SAFE_INTEGER) + if ((typeof this.#maximum === 'undefined' && [ CommandOptionType.NUMBER || CommandOptionType.INTEGER || CommandOptionType.TIME ].includes(this.type)) + || (this.#maximum && this.#maximum > Number.MAX_SAFE_INTEGER)) this.#maximum = Number.MAX_SAFE_INTEGER; this.#slashOption = options.slashOption ?? false; diff --git a/src/client/interfaces/Initialisable.ts b/src/client/interfaces/Initialisable.ts index 0506887..16e2122 100644 --- a/src/client/interfaces/Initialisable.ts +++ b/src/client/interfaces/Initialisable.ts @@ -1,7 +1,7 @@ // eslint-disable-next-line @typescript-eslint/no-explicit-any const isInitialisable = (obj: any): obj is Initialisable => { - return (Object.prototype.hasOwnProperty.call(obj, 'initialise') && typeof obj.initialise === 'function'); + return typeof obj.initialise === 'function'; }; interface Initialisable { diff --git a/src/middleware/Controller.ts b/src/middleware/Controller.ts index 0251e80..b4e94d3 100644 --- a/src/middleware/Controller.ts +++ b/src/middleware/Controller.ts @@ -10,8 +10,6 @@ import { MasterLogger } from '@navy.gif/logger'; import { Collection } from 'discord.js'; // Available for evals -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore import ClientUtils from './ClientUtils.js'; import Metrics from './Metrics.js'; // import ApiClientUtil from './ApiClientUtil.js'; @@ -42,6 +40,7 @@ class Controller extends EventEmitter #built: boolean; #api?: GalacticAPI; + clientUtils: typeof ClientUtils; constructor (options: ControllerOptions, version: string) { @@ -83,6 +82,7 @@ class Controller extends EventEmitter this.#built = false; this.#shards = new Collection(); + this.clientUtils = ClientUtils; // this.#shardingManager.on('message', this._handleMessage.bind(this)); process.on('SIGINT', this.shutdown.bind(this));