More slash command work
This commit is contained in:
parent
77913618d6
commit
c821d91254
26 changed files with 188 additions and 62 deletions
|
@ -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}"];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue