thaldrin/src/modules/developer/eval.ts

30 lines
727 B
TypeScript
Raw Normal View History

2021-04-04 15:17:46 +00:00
import Command from "../../handler/structures/Command";
export = class Eval extends Command {
constructor() {
super({
2021-04-08 00:43:17 +00:00
name: "eval",
2021-04-04 15:17:46 +00:00
description: "Evaluate JS code directly from the process.",
aliases: [
'ev',
'e'
],
cooldown: 0,
dev: true,
guild: false
})
}
async command(ctx: any) {
let code = ctx.args.join(" ")
try {
let evaled = await eval(code)
if (typeof evaled != 'string') {
evaled = (await import("util")).inspect(evaled, false, 1)
}
return evaled
} catch (error) {
}
}
}