aboutsummaryrefslogtreecommitdiff
path: root/src/arguments
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-09-18 22:27:57 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-09-18 22:27:57 -0400
commitdca5041fab25eb7c81cabd6ddbd418b311c65fcc (patch)
treea3adf9b13d5ca13dcd44112ef18abd0e7315d4d1 /src/arguments
parent04dc104726fa1519480ba1889c1307ec3ad9be19 (diff)
downloadtanzanite-dca5041fab25eb7c81cabd6ddbd418b311c65fcc.tar.gz
tanzanite-dca5041fab25eb7c81cabd6ddbd418b311c65fcc.tar.bz2
tanzanite-dca5041fab25eb7c81cabd6ddbd418b311c65fcc.zip
fix slowmode
Diffstat (limited to 'src/arguments')
-rw-r--r--src/arguments/contentWithDuration.ts2
-rw-r--r--src/arguments/duration.ts2
-rw-r--r--src/arguments/durationSeconds.ts6
-rw-r--r--src/arguments/roleWithDuation.ts2
4 files changed, 9 insertions, 3 deletions
diff --git a/src/arguments/contentWithDuration.ts b/src/arguments/contentWithDuration.ts
index 38b3fa4..27ff1db 100644
--- a/src/arguments/contentWithDuration.ts
+++ b/src/arguments/contentWithDuration.ts
@@ -3,6 +3,6 @@ import { BushArgumentTypeCaster } from '@lib';
export const contentWithDurationTypeCaster: BushArgumentTypeCaster = async (
_,
phrase
-): Promise<{ duration: number; contentWithoutTime: string | null }> => {
+): Promise<{ duration: number | null; contentWithoutTime: string | null }> => {
return client.util.parseDuration(phrase);
};
diff --git a/src/arguments/duration.ts b/src/arguments/duration.ts
index 6e76034..9f3cf99 100644
--- a/src/arguments/duration.ts
+++ b/src/arguments/duration.ts
@@ -1,5 +1,5 @@
import { BushArgumentTypeCaster } from '@lib';
-export const durationTypeCaster: BushArgumentTypeCaster = (_, phrase): number => {
+export const durationTypeCaster: BushArgumentTypeCaster = (_, phrase): number | null => {
return client.util.parseDuration(phrase).duration;
};
diff --git a/src/arguments/durationSeconds.ts b/src/arguments/durationSeconds.ts
new file mode 100644
index 0000000..6b0e91d
--- /dev/null
+++ b/src/arguments/durationSeconds.ts
@@ -0,0 +1,6 @@
+import { BushArgumentTypeCaster } from '../lib';
+
+export const durationSecondsTypeCaster: BushArgumentTypeCaster = (_, phrase): number | null => {
+ phrase += 's';
+ return client.util.parseDuration(phrase).duration;
+};
diff --git a/src/arguments/roleWithDuation.ts b/src/arguments/roleWithDuation.ts
index 54e6390..a63026d 100644
--- a/src/arguments/roleWithDuation.ts
+++ b/src/arguments/roleWithDuation.ts
@@ -3,7 +3,7 @@ import { BushArgumentTypeCaster } from '@lib';
export const roleWithDurationTypeCaster: BushArgumentTypeCaster = async (
message,
phrase
-): Promise<{ duration: number; role: string | null } | null> => {
+): Promise<{ duration: number | null; role: string | null } | null> => {
// eslint-disable-next-line prefer-const
let { duration, contentWithoutTime } = client.util.parseDuration(phrase);
if (contentWithoutTime === null || contentWithoutTime === undefined) return null;