feat: added more mature periods

This commit is contained in:
TresAbhi committed 2023-08-04 18:24:20 +00:00
1 parent 91f364b76a
commit 91dc45c880
27 files changed
+68 -67

No files matched your search

+13 -14
View File
@@ -2,10 +2,9 @@ import {
SlashCommandSubcommandBuilder,
SlashCommandSubcommandGroupBuilder,
} from 'discord.js';
import { PERIOD_NAMES } from '../discord/resolvePeriodFromCommand';
export type PeriodSubcommand = 'period' | 'custom';
export type PeriodOption = `${number}` | 'career';
export type PeriodType = 'period' | 'custom';
export type PeriodSize = `${number}` | 'career';
export default function addPeriodSubCommands(
option: SlashCommandSubcommandGroupBuilder,
@@ -17,18 +16,18 @@ export default function addPeriodSubCommands(
.addSubcommand((option) =>
extra(
option
.setName('period' satisfies PeriodSubcommand)
.setDescription(PERIOD_NAMES.period)
.setName('period' satisfies PeriodType)
.setDescription("Preset period's statistics")
.addStringOption((option) =>
option
.setName('period')
.setDescription('A preset period')
.setChoices(
{ name: 'Today', value: '1' satisfies PeriodOption },
{ name: '30 days', value: '30' satisfies PeriodOption },
{ name: '60 days', value: '60' satisfies PeriodOption },
{ name: '90 days', value: '90' satisfies PeriodOption },
{ name: 'Career', value: 'career' satisfies PeriodOption },
{ name: 'Today', value: '1' satisfies PeriodSize },
{ name: '30 days', value: '30' satisfies PeriodSize },
{ name: '60 days', value: '60' satisfies PeriodSize },
{ name: '90 days', value: '90' satisfies PeriodSize },
{ name: 'Career', value: 'career' satisfies PeriodSize },
)
.setRequired(true),
),
@@ -37,19 +36,19 @@ export default function addPeriodSubCommands(
.addSubcommand((option) =>
extra(
option
.setName('custom' satisfies PeriodSubcommand)
.setDescription(PERIOD_NAMES.custom)
.setName('custom' satisfies PeriodType)
.setDescription("Custom period's statistics")
.addIntegerOption((option) =>
option
.setName('start')
.setDescription('Start of period in days ago from today')
.setDescription('Days ago from today')
.setMinValue(0)
.setRequired(true),
)
.addIntegerOption((option) =>
option
.setName('end')
.setDescription('End of period in days ago from today')
.setDescription('Days ago from today')
.setMinValue(0)
.setRequired(true),
),