import { default as log } from "../util/log.js"; import * as action from "../util/discordAction.js"; import fs from "fs" const fileblacklist = [".env"] const prefix = process.env.PREFIX; export default { name: "sendfile", description: "uploads files from the specified path (i'm not stupid, you can't make it upload .env or anything outside the folder.", arguments: "path", execute(message, args) { let success = false const path = message.content.slice(prefix.length + this.name.length + 1); if (path.endsWith("ls")) { const files = fs.readdirSync(path.slice(0, path.length - 2)); fs.writeFileSync("resources/temporary/ls.txt", ""); lsmode = true; for (let file = 0; file < files.length; file++) { if (files[file] !== "ls.txt") { fs.appendFileSync("resources/soundboard/ls.txt", `${files[file]}\n`); } } success = "ls" } if (success) { action.sendMessage(message.channelId, { files: [ { attachment: `/${path}`, name: "" }, ], }); } else if (success = false) { action.reply(message, `unable to find file/path: /pepperbot/${path.slice(0, 2000)}`) } else if (success = "ls") { action.reply(message, { file: [{attachment: "resources/temporary/ls.txt", name: "ls.txt"}]}) } }, };