Remove delay parameter, change argument handling, make help command show proper flag types

This commit is contained in:
Essem 2022-06-07 18:26:40 -05:00
parent 28f0245652
commit 6b34cb9d9e
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
63 changed files with 82 additions and 219 deletions

View file

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

View file

@ -3,7 +3,7 @@ import ImageCommand from "../../classes/imageCommand.js";
class HomebrewCommand extends ImageCommand {
params() {
return {
caption: (this.type === "classic" ? this.args.join(" ") : this.options.text).toLowerCase().replaceAll("\n", " ")
caption: (this.options.text ?? this.args.join(" ")).toLowerCase().replaceAll("\n", " ")
};
}

View file

@ -3,7 +3,7 @@ import ImageCommand from "../../classes/imageCommand.js";
class SonicCommand extends ImageCommand {
params() {
const cleanedMessage = (this.type === "classic" ? this.args.join(" ") : this.options.text).replaceAll("&", "\\&amp;").replaceAll(">", "\\&gt;").replaceAll("<", "\\&lt;").replaceAll("\"", "\\&quot;").replaceAll("'", "\\&apos;").replaceAll("%", "\\%");
const cleanedMessage = (this.options.text ?? this.args.join(" ")).replaceAll("&", "\\&amp;").replaceAll(">", "\\&gt;").replaceAll("<", "\\&lt;").replaceAll("\"", "\\&quot;").replaceAll("'", "\\&apos;").replaceAll("%", "\\%");
return {
text: cleanedMessage
};