diff options
Diffstat (limited to 'src/arguments')
-rw-r--r-- | src/arguments/roleWithDuation.ts | 13 |
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 }; +}; |