2021-04-01 02:04:58 +00:00
|
|
|
const magick = require("../utils/image.js");
|
|
|
|
const wrap = require("../utils/wrap.js");
|
2019-09-13 20:02:41 +00:00
|
|
|
|
|
|
|
exports.run = async (message, args) => {
|
|
|
|
if (args.length === 0) return `${message.author.mention}, you need to provide some text to generate some retro text!`;
|
2019-12-02 20:47:22 +00:00
|
|
|
message.channel.sendTyping();
|
2021-04-01 02:04:58 +00:00
|
|
|
let [line1, line2, line3] = args.join(" ").replaceAll("&", "\\&").replaceAll(">", "\\>").replaceAll("<", "\\<").replaceAll("\"", "\\"").replaceAll("'", "\\'").replaceAll("%", "\\%").split(",").map(elem => elem.trim());
|
|
|
|
if (!line2 && line1.length > 15) {
|
|
|
|
const [split1, split2, split3] = wrap(line1, { width: 15, indent: "" }).split("\n");
|
|
|
|
line1 = split1;
|
|
|
|
line2 = split2 ? split2 : "";
|
|
|
|
line3 = split3 ? split3 : "";
|
2019-09-13 20:02:41 +00:00
|
|
|
} else {
|
2021-04-01 02:04:58 +00:00
|
|
|
if (!line2) {
|
|
|
|
line2 = "";
|
|
|
|
}
|
|
|
|
if (!line3) {
|
|
|
|
line3 = "";
|
|
|
|
}
|
2019-09-13 20:02:41 +00:00
|
|
|
}
|
2021-04-01 02:04:58 +00:00
|
|
|
const { buffer } = await magick.run({
|
|
|
|
cmd: "retro",
|
|
|
|
line1,
|
|
|
|
line2,
|
|
|
|
line3
|
|
|
|
});
|
2020-04-12 19:51:48 +00:00
|
|
|
return {
|
2021-04-01 02:04:58 +00:00
|
|
|
file: buffer,
|
2019-09-13 20:02:41 +00:00
|
|
|
name: "retro.png"
|
2020-04-12 19:51:48 +00:00
|
|
|
};
|
2019-12-02 20:47:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
exports.category = 4;
|
2019-12-05 16:58:46 +00:00
|
|
|
exports.help = "Generates a retro text image (separate lines with a comma)";
|
|
|
|
exports.params = "[top text], {middle text}, {bottom text}";
|