oof
This commit is contained in:
@ -1,35 +1,51 @@
|
||||
import { admins } from "../admin";
|
||||
import { getLevel } from "../admin.mjs";
|
||||
import fetch from "flumm-fetch-cookies";
|
||||
|
||||
import vm from "vm";
|
||||
|
||||
const maxoutput = 1000;
|
||||
let maxoutput = 750;
|
||||
let context = vm.createContext({
|
||||
e: null,
|
||||
bot: null,
|
||||
admins: null,
|
||||
fetch: fetch
|
||||
});
|
||||
export default bot => bot._trigger.set("sandbox_debug", new bot.trigger({
|
||||
call: /^\!debug (.*)/i,
|
||||
level: 100,
|
||||
active: true,
|
||||
f: e => {
|
||||
const args = e.message.trim().substring(7);
|
||||
if(args === "true" || args === "false")
|
||||
return e.self.debug = !e.self.debug;
|
||||
try {
|
||||
context.admins = admins;
|
||||
context.e = e;
|
||||
context.bot = bot;
|
||||
let output = vm.runInContext(args, vm.createContext(context));
|
||||
if (typeof output !== undefined && output) {
|
||||
output = JSON.stringify(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");
|
||||
|
||||
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) || {} ) ) );
|
||||
}
|
||||
catch (err) {
|
||||
e.reply(err.message);
|
||||
}, {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
}];
|
||||
};
|
||||
|
@ -1,3 +0,0 @@
|
||||
import debug from "./debug";
|
||||
|
||||
export default [ debug ];
|
Reference in New Issue
Block a user