aboutsummaryrefslogtreecommitdiff
path: root/src/lib/extensions
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-06-01 17:24:16 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-06-01 17:24:16 -0400
commit4c3474c63dc3c5deb5bc1dd9f37cc9d5812b62fd (patch)
tree7ef72c3c3ff9d3a896d8781c5c54b7303d4e5a29 /src/lib/extensions
parentd7099571b90c4211f90089bb41e90b0a08b86112 (diff)
downloadtanzanite-4c3474c63dc3c5deb5bc1dd9f37cc9d5812b62fd.tar.gz
tanzanite-4c3474c63dc3c5deb5bc1dd9f37cc9d5812b62fd.tar.bz2
tanzanite-4c3474c63dc3c5deb5bc1dd9f37cc9d5812b62fd.zip
chore: fromatting fixes, refactor ping command, hopefully fix duration rounding issues
Diffstat (limited to 'src/lib/extensions')
-rw-r--r--src/lib/extensions/discord-akairo/BushClientUtil.ts12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts
index c0df724..c5a5b30 100644
--- a/src/lib/extensions/discord-akairo/BushClientUtil.ts
+++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts
@@ -579,11 +579,12 @@ export class BushClientUtil extends ClientUtil {
* Converts a duration in milliseconds to a human readable form.
* @param duration The duration in milliseconds to convert.
* @param largest The maximum number of units to display for the duration.
+ * @param round Whether or not to round the smallest unit displayed.
* @returns A humanized string of the duration.
*/
- public humanizeDuration(duration: number, largest?: number): string {
- if (largest) return humanizeDuration(duration, { language: 'en', maxDecimalPoints: 2, largest })!;
- else return humanizeDuration(duration, { language: 'en', maxDecimalPoints: 2 })!;
+ public humanizeDuration(duration: number, largest?: number, round = true): string {
+ if (largest) return humanizeDuration(duration, { language: 'en', maxDecimalPoints: 2, largest, round })!;
+ else return humanizeDuration(duration, { language: 'en', maxDecimalPoints: 2, round })!;
}
/**
@@ -620,10 +621,11 @@ export class BushClientUtil extends ClientUtil {
* Creates a human readable representation between a date and the current time.
* @param date The date to be compared with the current time.
* @param largest The maximum number of units to display for the duration.
+ * @param round Whether or not to round the smallest unit displayed.
* @returns A humanized string of the delta.
*/
- public dateDelta(date: Date, largest?: number): string {
- return this.humanizeDuration(new Date().getTime() - date.getTime(), largest ?? 3);
+ public dateDelta(date: Date, largest?: number, round = true): string {
+ return this.humanizeDuration(new Date().getTime() - date.getTime(), largest ?? 3, round);
}
/**