21 lines
580 B
JavaScript
21 lines
580 B
JavaScript
import { SlashCommandBuilder } from "discord.js";
|
|
|
|
const data = new SlashCommandBuilder()
|
|
.setName("roll")
|
|
.setDescription("Prints a random number between 1 and input")
|
|
.addIntegerOption((option) =>
|
|
option
|
|
.setName("max")
|
|
.setDescription("Maximum output number")
|
|
.setRequired(true)
|
|
.setMinValue(1)
|
|
);
|
|
|
|
const execute = async (interaction) => {
|
|
const max = interaction.options.getInteger("max");
|
|
const roll = Math.floor(Math.random() * max) + 1;
|
|
await interaction.reply(`🎲 Rolled a ${roll} (max: ${max})`);
|
|
};
|
|
|
|
export { data, execute };
|