From 00ad00734ddb2c2fce8de8efcc010181c9ce1821 Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Sat, 26 Feb 2022 16:12:06 +0000 Subject: feat: use Time enum --- src/lib/extensions/discord-akairo/BushClientUtil.ts | 18 ++++++++++++------ src/lib/utils/BushConstants.ts | 3 +++ 2 files changed, 15 insertions(+), 6 deletions(-) (limited to 'src/lib') diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts index 36dc396..6b5cb39 100644 --- a/src/lib/extensions/discord-akairo/BushClientUtil.ts +++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts @@ -402,7 +402,7 @@ export class BushClientUtil extends ClientUtil { * @returns The combined elements or `ifEmpty`. * * @example - * const permissions = oxford([PermissionFlagsBits.Administrator, PermissionFlagsBits.SendMessages, PermissionFlagsBits.ManageMessages], 'and', 'none'); + * const permissions = oxford(['Administrator', 'SendMessages', 'ManageMessages'], 'and', 'none'); * console.log(permissions); // Administrator, SendMessages and ManageMessages */ public oxford(array: string[], conjunction: string, ifEmpty?: string): string | undefined { @@ -415,7 +415,14 @@ export class BushClientUtil extends ClientUtil { return array.join(', '); } + /** + * Get the global cache. + */ public getGlobal(): GlobalCache; + /** + * Get a key from the global cache. + * @param key The key to get in the global cache. + */ public getGlobal(key: K): GlobalCache[K]; public getGlobal(key?: keyof GlobalCache) { return key ? client.cache.global[key] : client.cache.global; @@ -651,12 +658,11 @@ export class BushClientUtil extends ClientUtil { } /** - * Wait an amount in seconds. - * @param seconds The number of seconds to wait - * @returns A promise that resolves after the specified amount of seconds + * Wait an amount in milliseconds. + * @returns A promise that resolves after the specified amount of milliseconds */ - public async sleep(seconds: number) { - return new Promise((resolve) => setTimeout(resolve, seconds * 1000)); + public get sleep() { + return promisify(setTimeout); } /** diff --git a/src/lib/utils/BushConstants.ts b/src/lib/utils/BushConstants.ts index 93de100..8d35522 100644 --- a/src/lib/utils/BushConstants.ts +++ b/src/lib/utils/BushConstants.ts @@ -3,6 +3,9 @@ import { BushClientUtil } from '../extensions/discord-akairo/BushClientUtil.js'; const rawCapeUrl = 'https://raw.githubusercontent.com/NotEnoughUpdates/capes/master/'; +/** + * Time units in milliseconds + */ export const enum Time { /** * One millisecond (1 ms). -- cgit