Levelsystem
This commit is contained in:
@ -1,36 +1,38 @@
|
||||
import { admins, getLevel } from "../admin.js";
|
||||
|
||||
const vm = require("vm");
|
||||
|
||||
let maxoutput = 500;
|
||||
let context = vm.createContext({
|
||||
e: null,
|
||||
bot: null
|
||||
bot: null,
|
||||
admins: null,
|
||||
});
|
||||
module.exports = bot => {
|
||||
bot._trigger.set("sandbox_debug", {
|
||||
call: /^\!debug (.*)/i,
|
||||
level: 0,
|
||||
level: 100,
|
||||
active: true,
|
||||
clients: ["irc", "tg"],
|
||||
f: e => {
|
||||
const args = e.message.trim().substring(7);
|
||||
if ((e.user.nick === "Flummi" && e.network === "n0xy")
|
||||
|| (e.user.nick === "belst" && e.network === "n0xy")
|
||||
|| (e.user.nick === "jkhsjdhjs" && e.network === "n0xy")
|
||||
) {
|
||||
try {
|
||||
let output = vm.runInContext(args, 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);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
e.reply(err.message);
|
||||
try {
|
||||
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
|
||||
e.reply(output);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
e.reply(err.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
@ -55,7 +55,7 @@ module.exports = bot => {
|
||||
|
||||
bot._trigger.set("sandbox", {
|
||||
call: /^\!(hs|py|cpp|bf|php|lua|bash) .*/i,
|
||||
level: 100,
|
||||
level: 0,
|
||||
active: true,
|
||||
clients: ["irc", "tg"],
|
||||
f: e => {
|
||||
@ -72,7 +72,7 @@ module.exports = bot => {
|
||||
|
||||
bot._trigger.set("sandbox_rs", {
|
||||
call: /^\!rs (.*)/i,
|
||||
level: 100,
|
||||
level: 0,
|
||||
active: true,
|
||||
clients: ["irc", "tg"],
|
||||
f: e => {
|
||||
@ -102,7 +102,7 @@ module.exports = bot => {
|
||||
|
||||
bot._trigger.set("bfgen", {
|
||||
call: /^\!bfgen .*/i,
|
||||
level: 100,
|
||||
level: 0,
|
||||
active: true,
|
||||
clients: ["irc", "tg"],
|
||||
f: e => {
|
||||
|
Reference in New Issue
Block a user