import { getLevel } from "../admin.mjs"; import fetch from "flumm-fetch-cookies"; import vm from "vm"; let maxoutput = 750; let context = vm.createContext({ e: null, bot: null, admins: null, fetch: fetch }); export default async bot => { return [{ name: "level", call: /^!level (.*)/i, active: true, f: e => { const user = e.message.trim().substring(7); e.reply( JSON.stringify( getLevel( e.self.user.get(user) || {} ) ) ); } }, { name: "sandbox_debug", call: /^\!debug (.*)/i, active: true, level: 100, f: e => { const args = e.message.trim().substring(7); try { 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 e.reply(output); } else e.reply("false lol"); } catch (err) { e.reply(err.message); } } }]; };