jillo-bot/src/commands/decrease.ts

22 lines
772 B
TypeScript
Raw Normal View History

2022-07-19 21:39:34 +02:00
import { SlashCommandBuilder } from '@discordjs/builders';
import { CommandInteraction, GuildMember } from 'discord.js';
import { changeCounterInteraction } from '../lib/counter';
module.exports = {
data: new SlashCommandBuilder()
.setName('decrease')
.setDescription('Decrease the counter')
.addIntegerOption((option) =>
2022-07-19 21:39:34 +02:00
option
.setName('amount')
.setRequired(false)
.setDescription('Amount to decrease the counter by')
.setMinValue(1)
),
execute: async (interaction: CommandInteraction, member: GuildMember) => {
2022-08-26 18:46:19 +02:00
await interaction.deferReply({ephemeral: true});
2022-10-17 20:04:30 +02:00
const amount = Math.trunc(interaction.options.getInteger('amount') || 1);
2022-07-19 21:39:34 +02:00
changeCounterInteraction(interaction, member, -amount);
}
};