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._
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 path;
if (images.includes(proposedfilename)) {
file = proposedfilename;
} else if (images.includes(proposedfilename.replaceAll(" ", "_"))) {
file = proposedfilename.replaceAll(" ", "_");
} else if (
images.includes(proposedfilename.replaceAll(" ", "_") + ".png")
) {
file = proposedfilename.replaceAll(" ", "_") + ".png";
} else if (
images.includes(proposedfilename + ".png") &&
proposedfilename !== "ls"
) {
file = proposedfilename += ".png";
} else if (proposedfilename === "ls") {
let possibleFilenames = {
regular: proposedfilename,
spaced: proposedfilename.replaceAll(" ", "_"),
spacedPng: proposedfilename.replaceAll(" ", "_") + ".png",
png: proposedfilename + ".png",
};
for (const value of Object.values(possibleFilenames)) {
if (images.includes(value)) {
file = value;
}
}
if (proposedfilename === "ls") {
lsMode = true;
file = "ls";
path = "../pepperbot/resources/vileimagery/ls.txt";
} else {
}
if (!file) {
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."
);
@ -42,7 +42,6 @@ module.exports = {
const randomnum = Math.floor(Math.random() * maxRan);
file = images[randomnum];
}
if (!lsMode) {
embed.setTitle(file.replaceAll("_", " ").replaceAll(".png", ""));
embed.setImage(`attachment://${file}`);