diff options
Diffstat (limited to 'src/arguments')
-rw-r--r-- | src/arguments/contentWithDuration.ts | 2 | ||||
-rw-r--r-- | src/arguments/duration.ts | 2 | ||||
-rw-r--r-- | src/arguments/durationSeconds.ts | 6 | ||||
-rw-r--r-- | src/arguments/roleWithDuation.ts | 2 |
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; |