More slash command work

This commit is contained in:
Essem 2022-03-31 14:53:22 -05:00
parent 77913618d6
commit c821d91254
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
26 changed files with 188 additions and 62 deletions

View file

@ -2,13 +2,21 @@ import Command from "../../classes/command.js";
class DiceCommand extends Command {
async run() {
if (this.args.length === 0 || !this.args[0].match(/^\d+$/)) {
const max = this.type === "classic" ? parseInt(this.args[0]) : this.options.max;
if (!max) {
return `🎲 The dice landed on ${Math.floor(Math.random() * 6) + 1}.`;
} else {
return `🎲 The dice landed on ${Math.floor(Math.random() * parseInt(this.args[0])) + 1}.`;
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}"];