23 lines
531 B
JavaScript
23 lines
531 B
JavaScript
|
import { encode } from "html-entities";
|
||
|
import util from "util";
|
||
|
|
||
|
function execute(client, event, args) {
|
||
|
var c = "";
|
||
|
try {
|
||
|
var result = eval(args);
|
||
|
c = util.format(result).replaceAll(process.env.ACCESS_TOKEN, "*".repeat(process.env.ACCESS_TOKEN.length));
|
||
|
} catch(err) {
|
||
|
c = util.format(err);
|
||
|
}
|
||
|
client.reply(event, c, `<pre><code>${encode(c)}</code></pre>`);
|
||
|
}
|
||
|
|
||
|
export default {
|
||
|
command: "eval",
|
||
|
name: "eval",
|
||
|
usage: "<code>",
|
||
|
owner: true,
|
||
|
desc: "Run JS code and reply with the result",
|
||
|
execute
|
||
|
}
|