aboutsummaryrefslogtreecommitdiff
path: root/src/arguments/roleWithDuation.ts
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-08-29 18:30:04 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-08-29 18:30:04 -0400
commita51dc607be54e600248c8c3c86f9881470ff4158 (patch)
tree6a3c6f5132fca493639790fb68b3368bc700990b /src/arguments/roleWithDuation.ts
parent0d71ac0234f7e71d60ae727a9f1db9ad66a47bde (diff)
downloadtanzanite-a51dc607be54e600248c8c3c86f9881470ff4158.tar.gz
tanzanite-a51dc607be54e600248c8c3c86f9881470ff4158.tar.bz2
tanzanite-a51dc607be54e600248c8c3c86f9881470ff4158.zip
level image, fixes, revamped role command (still broken), continued working on settings command
Diffstat (limited to 'src/arguments/roleWithDuation.ts')
-rw-r--r--src/arguments/roleWithDuation.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/arguments/roleWithDuation.ts b/src/arguments/roleWithDuation.ts
new file mode 100644
index 0000000..423e7df
--- /dev/null
+++ b/src/arguments/roleWithDuation.ts
@@ -0,0 +1,13 @@
+import { BushArgumentTypeCaster } from '@lib';
+
+export const roleWithDurationTypeCaster: BushArgumentTypeCaster = async (
+ message,
+ phrase
+): Promise<{ duration: number; role: string | null } | null> => {
+ const { duration, contentWithoutTime } = client.util.parseDuration(phrase);
+ if (contentWithoutTime === null || contentWithoutTime === undefined) return null;
+ const role = await util.arg.cast('role', client.commandHandler.resolver, message, contentWithoutTime);
+ console.debug(['role'], [role], [contentWithoutTime]);
+ if (!role) return null;
+ return { duration, role };
+};