penguin-band/commands/roll.js
2024-03-26 23:56:43 -05:00

24 lines
681 B
JavaScript

import { SlashCommandBuilder } from "discord.js";
import { ROLE_ID_PLAYER } from "../config.json";
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 permissions = [ROLE_ID_PLAYER];
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, permissions, execute };