cleaned up p/vileimagery a bit

This commit is contained in:
ayeuhugyu 2023-09-16 08:11:35 -07:00
parent dd17f173ff
commit a5e5442d31
2 changed files with 16 additions and 16 deletions

View file

@ -18,6 +18,7 @@ clean up p/vileimagery, its horrendous
**_Note:_** _versions before this were not uploaded to the repo, this is not the first version._ **_Note:_** _versions before this were not uploaded to the repo, this is not the first version._
1.8 - reorganized files some more, moved all events from index.js to seperate scripts in events folder, 1.8 - reorganized files some more, moved all events from index.js to seperate scripts in events folder,
1.8.1 - cleaned up p/vileimagery a bit
--- ---

View file

@ -17,24 +17,24 @@ module.exports = {
let lsMode = false; let lsMode = false;
let path; let path;
if (images.includes(proposedfilename)) { let possibleFilenames = {
file = proposedfilename; regular: proposedfilename,
} else if (images.includes(proposedfilename.replaceAll(" ", "_"))) { spaced: proposedfilename.replaceAll(" ", "_"),
file = proposedfilename.replaceAll(" ", "_"); spacedPng: proposedfilename.replaceAll(" ", "_") + ".png",
} else if ( png: proposedfilename + ".png",
images.includes(proposedfilename.replaceAll(" ", "_") + ".png") };
) { for (const value of Object.values(possibleFilenames)) {
file = proposedfilename.replaceAll(" ", "_") + ".png"; if (images.includes(value)) {
} else if ( file = value;
images.includes(proposedfilename + ".png") && }
proposedfilename !== "ls" }
) { if (proposedfilename === "ls") {
file = proposedfilename += ".png";
} else if (proposedfilename === "ls") {
lsMode = true; lsMode = true;
file = "ls"; file = "ls";
path = "../pepperbot/resources/vileimagery/ls.txt"; path = "../pepperbot/resources/vileimagery/ls.txt";
} else { }
if (!file) {
embed.setDescription( embed.setDescription(
"unable to find your file in the vile imagery folder, instead it has been replaced with a random one. put `ls` as your args to upload a file of all names. try replacing spaces with _s." "unable to find your file in the vile imagery folder, instead it has been replaced with a random one. put `ls` as your args to upload a file of all names. try replacing spaces with _s."
); );
@ -42,7 +42,6 @@ module.exports = {
const randomnum = Math.floor(Math.random() * maxRan); const randomnum = Math.floor(Math.random() * maxRan);
file = images[randomnum]; file = images[randomnum];
} }
if (!lsMode) { if (!lsMode) {
embed.setTitle(file.replaceAll("_", " ").replaceAll(".png", "")); embed.setTitle(file.replaceAll("_", " ").replaceAll(".png", ""));
embed.setImage(`attachment://${file}`); embed.setImage(`attachment://${file}`);