2021-08-19 14:19:14 +00:00
|
|
|
import { clean } from "../../utils/misc.js";
|
|
|
|
import Command from "../../classes/command.js";
|
2021-05-24 03:46:36 +00:00
|
|
|
|
|
|
|
class EvalRawCommand extends Command {
|
|
|
|
async run() {
|
2021-11-03 00:43:37 +00:00
|
|
|
const owners = process.env.OWNER.split(",");
|
|
|
|
if (!owners.includes(this.message.author.id)) return "Only the bot owner can use evalraw!";
|
2021-05-24 03:46:36 +00:00
|
|
|
const code = this.args.join(" ");
|
|
|
|
try {
|
|
|
|
const evaled = eval(code);
|
|
|
|
if (evaled.length >= 2000) {
|
|
|
|
return {
|
|
|
|
text: "The result was too large, so here it is as a file:",
|
|
|
|
file: evaled,
|
|
|
|
name: "result.txt"
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
return evaled;
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
return `\`ERROR\` \`\`\`xl\n${await clean(err)}\n\`\`\``;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static description = "Executes JavaScript code (with raw output)";
|
|
|
|
static aliases = ["run"];
|
|
|
|
static arguments = ["[code]"];
|
|
|
|
}
|
|
|
|
|
2021-08-19 14:19:14 +00:00
|
|
|
export default EvalRawCommand;
|