2021-12-10 21:39:54 +05:00
|
|
|
const Command = require("../../base/Command.js");
|
|
|
|
|
|
|
|
class Eval extends Command {
|
2021-12-26 19:29:37 +05:00
|
|
|
constructor(client) {
|
2021-12-10 21:39:54 +05:00
|
|
|
super(client, {
|
|
|
|
name: "eval",
|
|
|
|
dirname: __dirname,
|
|
|
|
enabled: true,
|
|
|
|
guildOnly: false,
|
|
|
|
aliases: [],
|
|
|
|
memberPermissions: [],
|
2021-12-26 19:29:37 +05:00
|
|
|
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
2021-12-10 21:39:54 +05:00
|
|
|
nsfw: false,
|
|
|
|
ownerOnly: true,
|
2021-12-22 17:32:50 +05:00
|
|
|
cooldown: 2000
|
2021-12-10 21:39:54 +05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// eslint-disable-next-line no-unused-vars
|
2021-12-26 19:29:37 +05:00
|
|
|
async run(message, args, data) {
|
2021-12-10 21:39:54 +05:00
|
|
|
// eslint-disable-next-line no-unused-vars
|
|
|
|
const usersData = this.client.usersData;
|
|
|
|
// eslint-disable-next-line no-unused-vars
|
|
|
|
const guildsData = this.client.guildsData;
|
2021-12-11 01:11:50 +05:00
|
|
|
|
2021-12-10 21:39:54 +05:00
|
|
|
const content = message.content.split(" ").slice(1).join(" ");
|
|
|
|
const result = new Promise((resolve) => resolve(eval(content)));
|
2021-12-11 01:11:50 +05:00
|
|
|
|
2021-12-10 21:39:54 +05:00
|
|
|
return result.then((output) => {
|
2021-12-26 19:29:37 +05:00
|
|
|
if (typeof output != "string") output = require("util").inspect(output, {
|
|
|
|
depth: 0
|
|
|
|
});
|
2021-12-11 01:11:50 +05:00
|
|
|
if (output.includes(this.client.token)) output = output.replace(this.client.token, "T0K3N");
|
2021-12-26 19:29:37 +05:00
|
|
|
message.channel.send(output, {
|
|
|
|
code: "js"
|
|
|
|
});
|
2021-12-10 21:39:54 +05:00
|
|
|
}).catch((err) => {
|
2021-12-13 18:27:54 +05:00
|
|
|
console.error(err);
|
2021-12-10 21:39:54 +05:00
|
|
|
err = err.toString();
|
2021-12-11 01:11:50 +05:00
|
|
|
if (err.includes(this.client.token)) err = err.replace(this.client.token, "T0K3N");
|
2021-12-26 19:29:37 +05:00
|
|
|
message.channel.send(err, {
|
|
|
|
code: "js"
|
|
|
|
});
|
2021-12-10 21:39:54 +05:00
|
|
|
});
|
|
|
|
}
|
2021-12-11 01:11:50 +05:00
|
|
|
};
|
2021-12-10 21:39:54 +05:00
|
|
|
|
|
|
|
module.exports = Eval;
|