21 lines
717 B
TypeScript
21 lines
717 B
TypeScript
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')
|
|
.addNumberOption((option) =>
|
|
option
|
|
.setName('amount')
|
|
.setRequired(false)
|
|
.setDescription('Amount to decrease the counter by')
|
|
.setMinValue(1)
|
|
),
|
|
|
|
execute: async (interaction: CommandInteraction, member: GuildMember) => {
|
|
const amount = Math.trunc(interaction.options.getNumber('amount') || 1);
|
|
changeCounterInteraction(interaction, member, -amount);
|
|
}
|
|
}; |