mirror of
https://github.com/aydenjahola/discord-multipurpose-bot.git
synced 2024-11-22 08:45:55 +00:00
24 lines
662 B
JavaScript
24 lines
662 B
JavaScript
|
const { SlashCommandBuilder } = require("discord.js");
|
||
|
|
||
|
module.exports = {
|
||
|
data: new SlashCommandBuilder()
|
||
|
.setName("roll")
|
||
|
.setDescription("Roll a dice!")
|
||
|
.addIntegerOption((option) =>
|
||
|
option
|
||
|
.setName("sides")
|
||
|
.setDescription("Number of sides on the dice")
|
||
|
.setRequired(false)
|
||
|
.setMinValue(2)
|
||
|
.setMaxValue(100)
|
||
|
),
|
||
|
|
||
|
async execute(interaction) {
|
||
|
const sides = interaction.options.getInteger("sides") || 6;
|
||
|
const result = Math.floor(Math.random() * sides) + 1;
|
||
|
await interaction.reply(
|
||
|
`🎲 You rolled a ${result} on a ${sides}-sided dice!`
|
||
|
);
|
||
|
},
|
||
|
};
|