2023-03-15 14:09:09 +00:00
|
|
|
import Command from "../../classes/command.js";
|
|
|
|
|
|
|
|
class DiceCommand extends Command {
|
|
|
|
async run() {
|
|
|
|
const max = this.options.max ?? parseInt(this.args[0]);
|
|
|
|
if (!max) {
|
|
|
|
return `🎲 The dice landed on ${Math.floor(Math.random() * 6) + 1}.`;
|
|
|
|
} else {
|
|
|
|
return `🎲 The dice landed on ${Math.floor(Math.random() * max) + 1}.`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static flags = [{
|
|
|
|
name: "max",
|
|
|
|
type: 4,
|
|
|
|
description: "The maximum dice value",
|
|
|
|
min_value: 1
|
|
|
|
}];
|
|
|
|
|
|
|
|
static description = "Rolls the dice";
|
|
|
|
static aliases = ["roll", "die", "rng", "random"];
|
|
|
|
static arguments = ["{number}"];
|
|
|
|
}
|
|
|
|
|
2021-08-19 14:19:14 +00:00
|
|
|
export default DiceCommand;
|