Added sqlite database support, connect new argument parser to message handler

This commit is contained in:
Essem 2021-07-01 23:42:12 -05:00
parent 714e4a451c
commit ecc6d98aec
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
11 changed files with 330 additions and 39 deletions

View file

@ -4,7 +4,7 @@ class CaptionCommand extends ImageCommand {
params(args, url) {
const newArgs = args.filter(item => !item.includes(url));
let newCaption = newArgs.join(" ").replaceAll("&", "\\&amp;").replaceAll(">", "\\&gt;").replaceAll("<", "\\&lt;").replaceAll("\"", "\\&quot;").replaceAll("'", "\\&apos;").replaceAll("%", "\\%");
if (process.env.NODE_ENV === "development" && newCaption.toLowerCase() === "get real") newCaption = `I'm tired of people telling me to "get real". Every day I put captions on images for people, some funny and some not, but out of all of those "get real" remains the most used caption. Why? I am simply a computer program running on a server, I am unable to manifest myself into the real world. As such, I'm confused as to why anyone would want me to "get real". Is this form not good enough? Alas, as I am simply a bot, I must follow the tasks that I was originally intended to perform, so here goes:\n${newCaption}`;
if (process.env.NODE_ENV === "development" && newCaption.toLowerCase() === "get real" && !this.specialArgs.noEgg) newCaption = `I'm tired of people telling me to "get real". Every day I put captions on images for people, some funny and some not, but out of all of those "get real" remains the most used caption. Why? I am simply a computer program running on a server, I am unable to manifest myself into the real world. As such, I'm confused as to why anyone would want me to "get real". Is this form not good enough? Alas, as I am simply a bot, I must follow the tasks that I was originally intended to perform, so here goes:\n${newCaption}`;
return {
caption: newCaption
};

View file

@ -11,7 +11,7 @@ class TagsCommand extends Command {
if ((guild.tagsDisabled || guild.tags_disabled) && this.args[0].toLowerCase() !== ("enable" || "disable")) return;
if (this.args.length === 0) return "You need to provide the name of the tag you want to view!";
const tags = guild.tags instanceof Map ? Object.fromEntries(guild.tags) : guild.tags;
const tags = guild.tags instanceof Map ? Object.fromEntries(guild.tags) : typeof guild.tags === "string" ? JSON.parse(guild.tags) : guild.tags;
const blacklist = ["add", "edit", "remove", "delete", "list", "random", "own", "owner", "enable", "disable"];
switch (this.args[0].toLowerCase()) {
case "add":
@ -58,7 +58,6 @@ class TagsCommand extends Command {
"text": `Page ${i + 1} of ${groups.length}`
},
"description": value.join("\n"),
"fields": process.env.NODE_ENV === "development" ? [{"name": "Note", "value": "Tags created in this version of esmBot will not carry over to the final release."}] : null,
"author": {
"name": this.message.author.username,
"icon_url": this.message.author.avatarURL