aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-02-26 16:12:06 +0000
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-02-26 16:12:06 +0000
commit00ad00734ddb2c2fce8de8efcc010181c9ce1821 (patch)
treee6b79047fd2cfbef4733cfbd488ee4cb47d600d5 /src/lib
parent1d6e64d5c43e4398e7c0488f114acba2c8a55164 (diff)
downloadtanzanite-00ad00734ddb2c2fce8de8efcc010181c9ce1821.tar.gz
tanzanite-00ad00734ddb2c2fce8de8efcc010181c9ce1821.tar.bz2
tanzanite-00ad00734ddb2c2fce8de8efcc010181c9ce1821.zip
feat: use Time enum
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/extensions/discord-akairo/BushClientUtil.ts18
-rw-r--r--src/lib/utils/BushConstants.ts3
2 files changed, 15 insertions, 6 deletions
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<K extends keyof GlobalCache>(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).