Made command outputs post as replies, fixed status changing on cluster restart, extra stuff

This commit is contained in:
TheEssem 2021-05-11 11:12:01 -05:00
parent 08ecfc7d10
commit 364d8bf006
41 changed files with 212 additions and 159 deletions

View file

@ -5,7 +5,7 @@ const Command = require("../../classes/command.js");
class CowsayCommand extends Command {
async run() {
if (this.args.length === 0) {
return `${this.message.author.mention}, you need to provide some text for the cow to say!`;
return "You need to provide some text for the cow to say!";
} else if (cows[this.args[0].toLowerCase()] != undefined) {
const cow = cows[this.args.shift().toLowerCase()];
return `\`\`\`\n${cowsay.say(this.args.join(" "), { cow })}\n\`\`\``;

View file

@ -2,7 +2,7 @@ const Command = require("../../classes/command.js");
class FullwidthCommand extends Command {
async run() {
if (this.args.length === 0) return `${this.message.author.mention}, you need to provide some text to convert to fullwidth!`;
if (this.args.length === 0) return "You need to provide some text to convert to fullwidth!";
return this.args.join("").replaceAll(/[A-Za-z0-9]/g, (s) => { return String.fromCharCode(s.charCodeAt(0) + 0xFEE0); });
}

View file

@ -3,7 +3,7 @@ const Command = require("../../classes/command.js");
class MCCommand extends Command {
async run() {
if (this.args.length === 0) return `${this.message.author.mention}, you need to provide some text to generate a Minecraft achievement!`;
if (this.args.length === 0) return "You need to provide some text to generate a Minecraft achievement!";
this.client.sendChannelTyping(this.message.channel.id);
const request = await fetch(`https://www.minecraftskinstealer.com/achievement/a.php?i=13&h=Achievement+get%21&t=${encodeURIComponent(this.args.join("+"))}`);
return {

View file

@ -1,12 +1,9 @@
const magick = require("../../utils/image.js");
const wrap = require("../../utils/wrap.js");
const Command = require("../../classes/command.js");
const ImageCommand = require("../../classes/imageCommand.js");
class RetroCommand extends Command {
async run() {
if (this.args.length === 0) return `${this.message.author.mention}, you need to provide some text to generate some retro text!`;
this.client.sendChannelTyping(this.message.channel.id);
let [line1, line2, line3] = this.args.join(" ").replaceAll("&", "\\&amp;").replaceAll(">", "\\&gt;").replaceAll("<", "\\&lt;").replaceAll("\"", "\\&quot;").replaceAll("'", "\\&apos;").replaceAll("%", "\\%").split(",").map(elem => elem.trim());
class RetroCommand extends ImageCommand {
params(args) {
let [line1, line2, line3] = args.join(" ").replaceAll("&", "\\&amp;").replaceAll(">", "\\&gt;").replaceAll("<", "\\&lt;").replaceAll("\"", "\\&quot;").replaceAll("'", "\\&apos;").replaceAll("%", "\\%").split(",").map(elem => elem.trim());
if (!line2 && line1.length > 15) {
const [split1, split2, split3] = wrap(line1, { width: 15, indent: "" }).split("\n");
line1 = split1;
@ -20,20 +17,16 @@ class RetroCommand extends Command {
line3 = "";
}
}
const { buffer } = await magick.run({
cmd: "retro",
line1,
line2,
line3
});
return {
file: buffer,
name: "retro.png"
};
return { line1, line2, line3 };
}
static description = "Generates a retro text image (separate lines with a comma)";
static arguments = ["[text]", "{middle text}", "{bottom text}"];
static arguments = ["[top text]", "{middle text}", "{bottom text}"];
static requiresImage = false;
static requiresText = true;
static noText = "You need to provide some text to make retro!";
static command = "retro";
}
module.exports = RetroCommand;

View file

@ -3,22 +3,22 @@ const Command = require("../../classes/command.js");
class RPSCommand extends Command {
async run() {
if (this.args.length === 0 || (this.args[0] !== "rock" && this.args[0] !== "paper" && this.args[0] !== "scissors")) return `${this.message.author.mention}, you need to choose whether you want to be rock, paper, or scissors!`;
if (this.args.length === 0 || (this.args[0] !== "rock" && this.args[0] !== "paper" && this.args[0] !== "scissors")) return "You need to choose whether you want to be rock, paper, or scissors!";
let emoji;
let winOrLose;
const result = misc.random(["rock", "paper", "scissors"]);
switch (result) {
case "rock":
emoji = "✊";
if (this.args[0].toLowerCase() === "paper") winOrLose = 1;
if (this.args[0].toLowerCase() === "paper") winOrLose = true;
break;
case "paper":
emoji = "✋";
if (this.args[0].toLowerCase() === "scissors") winOrLose = 1;
if (this.args[0].toLowerCase() === "scissors") winOrLose = true;
break;
case "scissors":
emoji = "✌";
if (this.args[0].toLowerCase() === "rock") winOrLose = 1;
if (this.args[0].toLowerCase() === "rock") winOrLose = true;
break;
default:
break;

View file

@ -20,7 +20,7 @@ class XKCDCommand extends Command {
};
return embed;
} catch {
return `${this.message.author.mention}, I couldn't get that XKCD!`;
return "I couldn't get that XKCD!";
}
}