JaBa/commands/Owner/eval.js

43 lines
1.1 KiB
JavaScript
Raw Normal View History

/* eslint-disable no-unused-vars */
const Command = require("../../base/Command");
2022-01-04 02:18:28 +05:00
class Eval extends Command {
constructor(client) {
super(client, {
name: "eval",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["ev"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: true,
cooldown: 2000
});
}
async run(message, args, data) {
2022-01-04 02:18:28 +05:00
const content = message.content.split(" ").slice(1).join(" ");
const result = new Promise((resolve) => resolve(eval(content)));
return result.then((output) => {
if (typeof output != "string") output = require("util").inspect(output, {
depth: 0
});
if (output.includes(this.client.token)) output = output.replace(this.client.token, "T0K3N");
2022-02-25 00:56:32 +05:00
message.reply({
content: "```js\n" + output + "```"
2022-01-04 02:18:28 +05:00
});
}).catch((err) => {
console.error(err);
err = err.toString();
if (err.includes(this.client.token)) err = err.replace(this.client.token, "T0K3N");
2022-02-25 00:56:32 +05:00
message.reply({
content: "```js\n" + err + "```"
2022-01-04 02:18:28 +05:00
});
});
}
2022-01-13 00:26:23 +05:00
}
2022-01-04 02:18:28 +05:00
module.exports = Eval;