penguin-band/commands/roll.js
2024-02-19 22:08:27 -06:00

24 lines
681 B
JavaScript

import { SlashCommandBuilder } from "discord.js";
import { PLAYER_ROLE_ID } 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 = [PLAYER_ROLE_ID];
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 };