router, api and stuff

This commit is contained in:
Flummi
2019-04-25 18:00:47 +00:00
parent 54ea970a3e
commit fb633ba64f
8 changed files with 145 additions and 67 deletions

View File

@ -1,4 +1,4 @@
import { admins, getLevel } from "../admin";
import { admins } from "../admin";
import vm from "vm";
const maxoutput = 1000;
@ -19,15 +19,14 @@ export default bot => bot._trigger.set("sandbox_debug", new bot.trigger({
context.admins = admins;
context.e = e;
context.bot = bot;
context.level = getLevel;
let output = vm.runInContext(args, vm.createContext(context));
if (typeof output !== undefined && output) {
output = JSON.stringify(output);
if (output.length > maxoutput)
return e.reply(`holy fuck, Ausgabe wäre viel zu lang! (${output.length} Zeichen :DDDDDD)`);
else
return e.reply(output);
return r.reply(output.length > maxoutput ? `holy fuck, Ausgabe wäre viel zu lang! (${output.length} Zeichen :DDDDDD)` : output);
}
else
e.reply("false lol");
}
catch (err) {
e.reply(err.message);