From a51dc607be54e600248c8c3c86f9881470ff4158 Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Sun, 29 Aug 2021 18:30:04 -0400 Subject: level image, fixes, revamped role command (still broken), continued working on settings command --- src/arguments/roleWithDuation.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/arguments/roleWithDuation.ts (limited to 'src/arguments/roleWithDuation.ts') 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 }; +}; -- cgit