jillo-bot/src/commands/increase.ts

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