outsourced trigger
This commit is contained in:
22
src/inc/trigger/abschieben.js
Normal file
22
src/inc/trigger/abschieben.js
Normal file
@ -0,0 +1,22 @@
|
||||
const Dest = [
|
||||
"nach Syrien", "in die Ukraine", "nach Timbuktu", "nach Uruguay",
|
||||
"nach Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch",
|
||||
"nach Bagdad", "nach Nordkorea", "nach Kurdistan", "nach Bayern",
|
||||
"nach Japan", "nach Irak", "in den Iran", "nach Saudi-Arabien",
|
||||
"nach Libyen", "nach Niger", "nach Uganda", "nach Afghanistan"
|
||||
];
|
||||
|
||||
module.exports = bot => {
|
||||
bot._trigger.set("abschieben", {
|
||||
call: /^(.|\/)abschieben/i,
|
||||
level: 0,
|
||||
active: true,
|
||||
clients: ["irc", "tg"],
|
||||
f: e => {
|
||||
let args = e.message.trim().split(" ");
|
||||
args.shift();
|
||||
args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0];
|
||||
e.replyAction(`schiebt ${args[0]} ${Dest[~~(Math.random() * Dest.length)]} ab.`);
|
||||
}
|
||||
});
|
||||
};
|
14
src/inc/trigger/butterkaese.js
Normal file
14
src/inc/trigger/butterkaese.js
Normal file
@ -0,0 +1,14 @@
|
||||
module.exports = bot => {
|
||||
bot._trigger.set("butterkaese", {
|
||||
call: /^(.|\/)butterkäse/i,
|
||||
level: 0,
|
||||
active: true,
|
||||
clients: ["irc", "tg"],
|
||||
f: e => {
|
||||
let args = e.message.trim().split(" ");
|
||||
args.shift();
|
||||
args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0];
|
||||
e.replyAction(`drischt mit einem großen Stück Butterkäse auf ${args[0]} ein.`);
|
||||
}
|
||||
});
|
||||
};
|
19
src/inc/trigger/kaffee.js
Normal file
19
src/inc/trigger/kaffee.js
Normal file
@ -0,0 +1,19 @@
|
||||
const texte = [
|
||||
`einen frisch gebrühten Kaffee aus aromatisch hochwertigen und laktosefreien Kaffeebohnen, die nach dem Vorbild der kolonisierten Ausbeutung herangewachsen und importiert worden sind`,
|
||||
`einen frisch gebrühten Kaffee aus aromatisch minderwertigen Kaffeebohnen, die zu einem überhöhten Preis und nach dem Prinzip des Fairtrade® herangewachsen und importiert worden sind`
|
||||
];
|
||||
|
||||
module.exports = bot => {
|
||||
bot._trigger.set("kaffee", {
|
||||
call: /^(.|\/)kaffee/i,
|
||||
level: 0,
|
||||
active: true,
|
||||
clients: ["irc", "tg"],
|
||||
f: e => {
|
||||
let args = e.message.trim().split(" ");
|
||||
args.shift();
|
||||
args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0];
|
||||
e.replyAction(`serviert ${args.join(" ")} ${texte[~~(Math.random() * texte.length)]}; Prost!`);
|
||||
}
|
||||
});
|
||||
};
|
29
src/inc/trigger/sandbox.js
Normal file
29
src/inc/trigger/sandbox.js
Normal file
@ -0,0 +1,29 @@
|
||||
const vm = require("vm");
|
||||
|
||||
module.exports = bot => {
|
||||
bot._trigger.set("sandbox", {
|
||||
call: /^\!js (.*)/i,
|
||||
level: 100,
|
||||
active: true,
|
||||
clients: ["irc", "tg"],
|
||||
f: e => {
|
||||
const args = e.message.substring(3);
|
||||
const context = {
|
||||
e: e,
|
||||
b: bot
|
||||
};
|
||||
try {
|
||||
let output = vm.runInNewContext(args, context);
|
||||
if (typeof output !== undefined && output) {
|
||||
output = JSON.stringify(output);
|
||||
if (output !== "Converting circular structure to JSON") {
|
||||
e.reply(output.length > 400 ? `holy fuck, Ausgabe wäre viel zu lang! (${output.length} Zeichen :DDDDDD)` : output);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
e.reply(err.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
Reference in New Issue
Block a user