diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/common/util/Moderation.ts | 3 | ||||
-rw-r--r-- | src/lib/extensions/discord-akairo/BushClientUtil.ts | 21 |
2 files changed, 13 insertions, 11 deletions
diff --git a/src/lib/common/util/Moderation.ts b/src/lib/common/util/Moderation.ts index c018852..e5cb872 100644 --- a/src/lib/common/util/Moderation.ts +++ b/src/lib/common/util/Moderation.ts @@ -93,8 +93,7 @@ export class Moderation { const user = (await util.resolveNonCachedUser(options.user))!.id; const moderator = (await util.resolveNonCachedUser(options.moderator))!.id; const guild = client.guilds.resolveId(options.guild)!; - // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing - const duration = options.duration || undefined; + const duration = options.duration ? options.duration : undefined; // If guild does not exist create it so the modlog can reference a guild. await Guild.findOrCreate({ diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts index d7416bb..9a8e408 100644 --- a/src/lib/extensions/discord-akairo/BushClientUtil.ts +++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts @@ -682,11 +682,11 @@ export class BushClientUtil extends ClientUtil { .filter( (p, i, arr) => typeof Object.getOwnPropertyDescriptor(obj_, p)?.['get'] !== 'function' && // ignore getters - typeof Object.getOwnPropertyDescriptor(obj_, p)?.['set'] !== 'function' && // ignore setters - typeof obj_[p] === 'function' && //only the methods - p !== 'constructor' && //not the constructor - (i == 0 || p !== arr[i - 1]) && //not overriding in this prototype - props.indexOf(p) === -1 //not overridden in a child + typeof Object.getOwnPropertyDescriptor(obj_, p)?.['set'] !== 'function' && // ignore setters + typeof obj_[p] === 'function' && // only the methods + p !== 'constructor' && // not the constructor + (i == 0 || p !== arr[i - 1]) && // not overriding in this prototype + props.indexOf(p) === -1 // not overridden in a child ); const reg = /\(([\s\S]*?)\)/; @@ -705,8 +705,8 @@ export class BushClientUtil extends ClientUtil { ) ); } while ( - (obj_ = Object.getPrototypeOf(obj_)) && //walk-up the prototype chain - Object.getPrototypeOf(obj_) //not the the Object prototype methods (hasOwnProperty, etc...) + (obj_ = Object.getPrototypeOf(obj_)) && // walk-up the prototype chain + Object.getPrototypeOf(obj_) // not the the Object prototype methods (hasOwnProperty, etc...) ); return props.join('\n'); @@ -801,8 +801,6 @@ export class BushClientUtil extends ClientUtil { : message.util.parsed?.prefix ?? client.config.prefix; } - // public retryAsync<P extends [], R>(func: (...args: P) => R, repeatFreq: number, numRepeat: number): R | Promise<null> {} - /** * Recursively apply provided options operations on object * and all of the object properties that are either object or function. @@ -849,6 +847,11 @@ export class BushClientUtil extends ClientUtil { return deepLock; } + public get time(): Record<keyof typeof client.constants.timeUnits, number> { + const values = Object.entries(client.constants.timeUnits).map(([key, value]) => [key, value.value]); + return Object.fromEntries(values); + } + /** * A wrapper for the Argument class that adds custom typings. */ |