More fixes

This commit is contained in:
Erik 2023-12-08 14:26:41 +02:00
parent b14ffc677d
commit 8eae17c7d2
4 changed files with 6 additions and 5 deletions

View File

@ -85,7 +85,7 @@ export default class AutoModeration extends Observer implements Initialisable
// Fetch a list of TLDs from iana // Fetch a list of TLDs from iana
const tldList = await this.client.managerEval(` const tldList = await this.client.managerEval(`
(() => { (() => {
return ClientUtils.fetchTlds() return this.clientUtils.fetchTlds();
})() })()
`).catch(this.logger.error.bind(this.logger)) as string[] | undefined; `).catch(this.logger.error.bind(this.logger)) as string[] | undefined;

View File

@ -101,7 +101,8 @@ class CommandOption
this.#minimum = options.minimum; this.#minimum = options.minimum;
if (typeof options.maximum === 'number') if (typeof options.maximum === 'number')
this.#maximum = options.maximum; 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.#maximum = Number.MAX_SAFE_INTEGER;
this.#slashOption = options.slashOption ?? false; this.#slashOption = options.slashOption ?? false;

View File

@ -1,7 +1,7 @@
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
const isInitialisable = (obj: any): obj is Initialisable => 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 { interface Initialisable {

View File

@ -10,8 +10,6 @@ import { MasterLogger } from '@navy.gif/logger';
import { Collection } from 'discord.js'; import { Collection } from 'discord.js';
// Available for evals // Available for evals
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import ClientUtils from './ClientUtils.js'; import ClientUtils from './ClientUtils.js';
import Metrics from './Metrics.js'; import Metrics from './Metrics.js';
// import ApiClientUtil from './ApiClientUtil.js'; // import ApiClientUtil from './ApiClientUtil.js';
@ -42,6 +40,7 @@ class Controller extends EventEmitter
#built: boolean; #built: boolean;
#api?: GalacticAPI; #api?: GalacticAPI;
clientUtils: typeof ClientUtils;
constructor (options: ControllerOptions, version: string) constructor (options: ControllerOptions, version: string)
{ {
@ -83,6 +82,7 @@ class Controller extends EventEmitter
this.#built = false; this.#built = false;
this.#shards = new Collection(); this.#shards = new Collection();
this.clientUtils = ClientUtils;
// this.#shardingManager.on('message', this._handleMessage.bind(this)); // this.#shardingManager.on('message', this._handleMessage.bind(this));
process.on('SIGINT', this.shutdown.bind(this)); process.on('SIGINT', this.shutdown.bind(this));