Eh, why not
This commit is contained in:
parent
248ea8a71b
commit
97012f4087
1 changed files with 29 additions and 0 deletions
29
commands/general/evalraw.js
Normal file
29
commands/general/evalraw.js
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
const { clean } = require("../../utils/misc.js");
|
||||||
|
const Command = require("../../classes/command.js");
|
||||||
|
|
||||||
|
class EvalRawCommand extends Command {
|
||||||
|
async run() {
|
||||||
|
if (this.message.author.id !== process.env.OWNER) return "Only the bot owner can use evalraw!";
|
||||||
|
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]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = EvalRawCommand;
|
Loading…
Add table
Add a link
Reference in a new issue