stdvars for trigger :/

This commit is contained in:
Flummi 2017-11-27 00:00:54 +01:00
parent ddd1530c8e
commit cef5d1463c
13 changed files with 147 additions and 308 deletions

View File

@ -7,15 +7,17 @@ read().then(() => {
let bot = new wrapper(); let bot = new wrapper();
const self = { const self = {
_trigger: new Map() _trigger: new Map(),
trigger: trigger
}; };
fs.readdirSync(`${__dirname}/inc/trigger/`).forEach(file => { /*fs.readdirSync(`${__dirname}/inc/trigger/`).forEach(file => {
if(file.substr(-3, 3) === ".js") { if(file.substr(-3, 3) === ".js") {
logger.info(`(main) loading trigger: ${file}`); logger.info(`(main) loading trigger: ${file}`);
require(`${__dirname}/inc/trigger/${file}`)(self); require(`${__dirname}/inc/trigger/${file}`)(self);
} }
}); });*/
require(`${__dirname}/inc/trigger/kernel.js`)(self);
bot.on("message", e => { // Todo: eventhandler bot.on("message", e => { // Todo: eventhandler
for (var [name, trigger] of self._trigger.entries()) { for (var [name, trigger] of self._trigger.entries()) {
@ -38,6 +40,8 @@ read().then(() => {
e.reply(`no permission, min level ${trigger.level} required`); e.reply(`no permission, min level ${trigger.level} required`);
break; break;
} }
console.log(trigger);
trigger.f(e); trigger.f(e);
} }
logger.info(`${e.network} -> ${e.channel} -> ${e.user.nick}: ${e.message}`); logger.info(`${e.network} -> ${e.channel} -> ${e.user.nick}: ${e.message}`);
@ -46,4 +50,12 @@ read().then(() => {
bot.on("ctcp:version", e => { bot.on("ctcp:version", e => {
e.write(`notice ${e.user.nick} :\u0001VERSION Pimmel 2.1\u0001`); e.write(`notice ${e.user.nick} :\u0001VERSION Pimmel 2.1\u0001`);
}); });
}); });
function trigger(args, trigger) {
this.call = args.call;
this.level = args.level || 0;
this.active = args.active || true;
this.clients = args.clients || ["irc", "tg"];
this.f = args.f;
}

View File

@ -8,10 +8,9 @@ const _opts = {
const _debug = false; const _debug = false;
module.exports = bot => { module.exports = bot => {
bot._trigger.set("cfg", { bot._trigger.set("cfg", new bot.trigger({
call: /^\!cfg/i, call: /^\!cfg/i,
level: 100, level: 100,
active: true,
clients: ["irc"], clients: ["irc"],
f: e => { f: e => {
let args = e.message.substring(5); let args = e.message.substring(5);
@ -91,5 +90,5 @@ module.exports = bot => {
} }
} }
}); }));
}; };

View File

@ -15,11 +15,8 @@ const markets = {
}; };
module.exports = bot => { module.exports = bot => {
bot._trigger.set("coins", { bot._trigger.set("coins", new bot.trigger({
call: /^(\.|\/)(btc|eth|xmr)/i, call: /^(\.|\/)(btc|eth|xmr)/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().substr(1).toLowerCase().split(" "); let args = e.message.trim().substr(1).toLowerCase().split(" ");
cryptowat_summary(args[0], markets[args[0]], args[0] !== "xmr" ? args[1] : "usd").then( cryptowat_summary(args[0], markets[args[0]], args[0] !== "xmr" ? args[1] : "usd").then(
@ -27,7 +24,7 @@ module.exports = bot => {
reject => e.reply(reject) reject => e.reply(reject)
); );
} }
}); }));
}; };
const cryptowat_summary = (crypto, market, currency) => { const cryptowat_summary = (crypto, market, currency) => {

View File

@ -2,10 +2,9 @@ import sql from "../sql.js";
import { getLevel, loadAdmins } from "../admin.js"; import { getLevel, loadAdmins } from "../admin.js";
module.exports = bot => { module.exports = bot => {
bot._trigger.set("join", { bot._trigger.set("join", new bot.trigger({
call: /^\!join .*/i, call: /^\!join .*/i,
level: 100, level: 100,
active: true,
clients: ["irc"], clients: ["irc"],
f: e => { f: e => {
let args = e.message.trim().substring(6).split(" "); let args = e.message.trim().substring(6).split(" ");
@ -13,12 +12,11 @@ module.exports = bot => {
chans.map(e.join); chans.map(e.join);
e.reply(`joined channel${chans.length > 1 ? "s" : null}: ${chans.join(", ")}`); e.reply(`joined channel${chans.length > 1 ? "s" : null}: ${chans.join(", ")}`);
} }
}); }));
bot._trigger.set("part", { bot._trigger.set("part", new bot.trigger({
call: /^\!part .*/i, call: /^\!part .*/i,
level: 100, level: 100,
active: true,
clients: ["irc"], clients: ["irc"],
f: e => { f: e => {
let args = e.message.trim().substring(6).split(" "); let args = e.message.trim().substring(6).split(" ");
@ -26,12 +24,11 @@ module.exports = bot => {
chans.map(e.part); chans.map(e.part);
e.reply(`parted channel${chans.length > 1 ? "s" : null}: ${chans.join(", ")}`); e.reply(`parted channel${chans.length > 1 ? "s" : null}: ${chans.join(", ")}`);
} }
}); }));
bot._trigger.set("nick", { bot._trigger.set("nick", new bot.trigger({
call: /^\!nick .*/i, call: /^\!nick .*/i,
level: 100, level: 100,
active: true,
clients: ["irc"], clients: ["irc"],
f: e => { f: e => {
let args = e.message.trim().substring(6).split(" "); let args = e.message.trim().substring(6).split(" ");
@ -40,12 +37,11 @@ module.exports = bot => {
e.whois(args[0]); e.whois(args[0]);
e.reply(`changed nick to ${args[0]}`); e.reply(`changed nick to ${args[0]}`);
} }
}); }));
bot._trigger.set("level", { bot._trigger.set("level", new bot.trigger({
call: /^\!level/i, call: /^\!level/i,
level: 0, level: 0,
active: true,
clients: ["irc"], clients: ["irc"],
f: e => { f: e => {
const args = e.message.split(' '); const args = e.message.split(' ');
@ -122,5 +118,5 @@ module.exports = bot => {
} }
} }
}); }));
}; };

View File

@ -9,11 +9,9 @@ let context = vm.createContext({
admins: null, admins: null,
}); });
module.exports = bot => { module.exports = bot => {
bot._trigger.set("sandbox_debug", { bot._trigger.set("sandbox_debug", new bot.trigger({
call: /^\!debug (.*)/i, call: /^\!debug (.*)/i,
level: 100, level: 100,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
const args = e.message.trim().substring(7); const args = e.message.trim().substring(7);
try { try {
@ -34,5 +32,5 @@ module.exports = bot => {
e.reply(err.message); e.reply(err.message);
} }
} }
}); }));
}; };

View File

@ -12,11 +12,8 @@ Object.keys(data).forEach(cur => {
}); });
module.exports = bot => { module.exports = bot => {
bot._trigger.set("dope", { bot._trigger.set("dope", new bot.trigger({
call: /^(\.|\/)dope/i, call: /^(\.|\/)dope/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().split(" "); let args = e.message.trim().split(" ");
args.shift(); args.shift();
@ -32,13 +29,10 @@ module.exports = bot => {
e.replyAction(`${action[0]} a ${consume_type} of the finest ${strain_type} "${strain}" ${action[1]} [b]${args[0]}[/b]`); e.replyAction(`${action[0]} a ${consume_type} of the finest ${strain_type} "${strain}" ${action[1]} [b]${args[0]}[/b]`);
} }
}); }));
bot._trigger.set("meth", { bot._trigger.set("meth", new bot.trigger({
call: /^(\.|\/)meth/i, call: /^(\.|\/)meth/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().split(" "); let args = e.message.trim().split(" ");
args.shift(); args.shift();
@ -46,5 +40,5 @@ module.exports = bot => {
e.replyAction(`legt [b]${args[0]}[/b] eine dicke Line Meth \\________`); e.replyAction(`legt [b]${args[0]}[/b] eine dicke Line Meth \\________`);
} }
}); }));
}; };

View File

@ -3,16 +3,13 @@ const rp = require("request-promise");
const feed = "https://www.kernel.org/releases.json"; const feed = "https://www.kernel.org/releases.json";
module.exports = bot => { module.exports = bot => {
bot._trigger.set("kernel", { bot._trigger.set("kernel", new bot.trigger({
call: /^(\.|\/)kernel/i, call: /^(\.|\/)kernel/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
rp(feed).then(content => { rp(feed).then(content => {
const releases = JSON.parse(content).releases; const releases = JSON.parse(content).releases;
e.reply(releases.map(entry => `[b]${entry.version}[/b] (${entry.moniker}${entry.iseol ? `, [i]EOL[/i]` : ""})`).join(", ")); e.reply(releases.map(entry => `[b]${entry.version}[/b] (${entry.moniker}${entry.iseol ? `, [i]EOL[/i]` : ""})`).join(", "));
}); });
} }
}); }));
}; }

View File

@ -1,9 +1,8 @@
import sql from "../sql.js"; import sql from "../sql.js";
module.exports = bot => { module.exports = bot => {
bot._trigger.set("mcmaniac_add", { bot._trigger.set("mcmaniac_add", new bot.trigger({
call: /Mc.*iaC/, call: /Mc.*iaC/,
level: 0,
active: false, active: false,
clients: ["irc", "tg"], clients: ["irc", "tg"],
f: e => { f: e => {
@ -13,11 +12,10 @@ module.exports = bot => {
.then() .then()
.catch(err => {}); .catch(err => {});
} }
}); }));
bot._trigger.set("mcmaniac_get", { bot._trigger.set("mcmaniac_get", new bot.trigger({
call: /^(\.|\/)mcmaniac/i, call: /^(\.|\/)mcmaniac/i,
level: 0,
active: false, active: false,
clients: ["irc", "tg"], clients: ["irc", "tg"],
f: e => { f: e => {
@ -52,5 +50,5 @@ module.exports = bot => {
console.log(err); console.log(err);
}); });
} }
}); }));
}; };

View File

@ -12,9 +12,8 @@ const _args = [
module.exports = bot => { module.exports = bot => {
bot._trigger.set("parser", { bot._trigger.set("parser", new bot.trigger({
call: /https?:\/\/[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?/gi, call: /https?:\/\/[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?/gi,
level: 0,
active: true, active: true,
clients: ["irc"], clients: ["irc"],
f: e => { f: e => {
@ -32,7 +31,7 @@ module.exports = bot => {
}); });
} }
} }
}); }));
}; };
function checkRepost(link) { function checkRepost(link) {

View File

@ -24,11 +24,8 @@ insert into nxy_quotes
`; `;
module.exports = bot => { module.exports = bot => {
bot._trigger.set("quotes", { bot._trigger.set("quotes", new bot.trigger({
call: /^(\.|\/)q .*/i, call: /^(\.|\/)q .*/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().substring(3).split(" "); let args = e.message.trim().substring(3).split(" ");
const cmd = args[0].toLowerCase(); const cmd = args[0].toLowerCase();
@ -84,5 +81,5 @@ module.exports = bot => {
break; break;
} }
} }
}); }));
}; };

View File

@ -15,11 +15,8 @@ sql.exec("select `data` from `useless` where `trigger` = 'sandbox_js'")
}); });
module.exports = bot => { module.exports = bot => {
bot._trigger.set("sandbox_js", { bot._trigger.set("sandbox_js", new bot.trigger({
call: /^\!js (.*)/i, call: /^\!js (.*)/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
const args = e.message.trim().substring(4); const args = e.message.trim().substring(4);
if (!_contexts.has(`${e.network}.${e.channel}.${e.user.nick}`)) if (!_contexts.has(`${e.network}.${e.channel}.${e.user.nick}`))
@ -55,13 +52,10 @@ module.exports = bot => {
e.reply(err.message); e.reply(err.message);
} }
} }
}); }));
bot._trigger.set("sandbox", { bot._trigger.set("sandbox", new bot.trigger({
call: /^\!(hs|py|cpp|bf|php|lua|bash) .*/i, call: /^\!(hs|py|cpp|bf|php|lua|bash) .*/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().substring(1).split(" "); let args = e.message.trim().substring(1).split(" ");
const lang = args.shift(); const lang = args.shift();
@ -72,13 +66,10 @@ module.exports = bot => {
reject => e.reply(reject.replace("\n", " ")) reject => e.reply(reject.replace("\n", " "))
); );
} }
}); }));
bot._trigger.set("sandbox_rs", { bot._trigger.set("sandbox_rs", new bot.trigger({
call: /^\!rs (.*)/i, call: /^\!rs (.*)/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
const args = e.message.substring(4); const args = e.message.substring(4);
const params = { const params = {
@ -102,17 +93,14 @@ module.exports = bot => {
e.reply(err); e.reply(err);
}); });
} }
}); }));
bot._trigger.set("bfgen", { bot._trigger.set("bfgen", new bot.trigger({
call: /^\!bfgen .*/i, call: /^\!bfgen .*/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().substring(7); let args = e.message.trim().substring(7);
let output = bfgen(args); let output = bfgen(args);
e.reply(output.length > maxoutput ? `holy fuck, Ausgabe wäre viel zu lang! (${output.length} Zeichen :DDDDDD)` : output); e.reply(output.length > maxoutput ? `holy fuck, Ausgabe wäre viel zu lang! (${output.length} Zeichen :DDDDDD)` : output);
} }
}); }));
}; };

View File

@ -17,37 +17,28 @@ Object.keys(data).forEach(cur => {
}); });
module.exports = bot => { module.exports = bot => {
bot._trigger.set("kiss", { bot._trigger.set("kiss", new bot.trigger({
call: /^(\.|\/)kiss/i, call: /^(\.|\/)kiss/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().split(" "); let args = e.message.trim().split(" ");
args.shift(); args.shift();
args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0]; args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0];
e.reply(`(づ。◕‿‿◕。)づ" [color=red]。。・゜゜・。。・゜❤[/color] [b]${args.join(" ").trim()}[/b] [color=red]❤[/color]`); e.reply(`(づ。◕‿‿◕。)づ" [color=red]。。・゜゜・。。・゜❤[/color] [b]${args.join(" ").trim()}[/b] [color=red]❤[/color]`);
} }
}); }));
bot._trigger.set("hug", { bot._trigger.set("hug", new bot.trigger({
call: /^(\.|\/)hug/i, call: /^(\.|\/)hug/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().split(" "); let args = e.message.trim().split(" ");
args.shift(); args.shift();
args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0]; args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0];
e.reply(`[color=red]♡❤♡♥[/color] [b]${args.join(" ").trim()}[/b] [color=red]♥♡❤♡♥[/color]`); e.reply(`[color=red]♡❤♡♥[/color] [b]${args.join(" ").trim()}[/b] [color=red]♥♡❤♡♥[/color]`);
} }
}); }));
bot._trigger.set("kill", { bot._trigger.set("kill", new bot.trigger({
call: /^(\.|\/)kill/i, call: /^(\.|\/)kill/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().split(" "); let args = e.message.trim().split(" ");
args.shift(); args.shift();
@ -66,13 +57,10 @@ module.exports = bot => {
.replace("{bomb}", data.kill_parts.bomb[~~(Math.random() * data.kill_parts.bomb.length)]) .replace("{bomb}", data.kill_parts.bomb[~~(Math.random() * data.kill_parts.bomb.length)])
); );
} }
}); }));
bot._trigger.set("yiff", { bot._trigger.set("yiff", new bot.trigger({
call: /^(\.|\/)yiff/i, call: /^(\.|\/)yiff/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().split(" "); let args = e.message.trim().split(" ");
args.shift(); args.shift();
@ -82,147 +70,113 @@ module.exports = bot => {
.split("{user}").join(`[b]${args[0]}[/b]`) .split("{user}").join(`[b]${args[0]}[/b]`)
.split("{yiffer}").join(`[b]${e.user.nick}[/b]`) .split("{yiffer}").join(`[b]${e.user.nick}[/b]`)
.split("{nick}").join(`[b]${e.self.me.nickname}[/b]`) .split("{nick}").join(`[b]${e.self.me.nickname}[/b]`)
.split("{channel}").join(`${e.channel}`)
); );
} }
}); }));
bot._trigger.set("bier", { bot._trigger.set("bier", new bot.trigger({
call: /^(\.|\/)bier/i, call: /^(\.|\/)bier/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().split(" "); let args = e.message.trim().split(" ");
args.shift(); args.shift();
args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0]; args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0];
e.replyAction(`schenkt ein kühles Blondes an [b]${args[0]}[/b] aus.`); e.replyAction(`schenkt ein kühles Blondes an [b]${args[0]}[/b] aus.`);
} }
}); }));
bot._trigger.set("fucken", { bot._trigger.set("fucken", new bot.trigger({
call: /^(\.|\/)fucken/i, call: /^(\.|\/)fucken/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().split(" "); let args = e.message.trim().split(" ");
args.shift(); args.shift();
args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0]; args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0];
e.replyAction(`fuckt [b]${args[0]}[/b] und tötet [b]${args[0]}[/b] anschließend.`); e.replyAction(`fuckt [b]${args[0]}[/b] und tötet [b]${args[0]}[/b] anschließend.`);
} }
}); }));
bot._trigger.set("hack", { bot._trigger.set("hack", new bot.trigger({
call: /^(\.|\/)hack/i, call: /^(\.|\/)hack/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().split(" "); let args = e.message.trim().split(" ");
args.shift(); args.shift();
args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0]; args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0];
e.reply(`hacking ${args[0]}...`); e.reply(`hacking ${args[0]}...`);
} }
}); }));
bot._trigger.set("spit", { bot._trigger.set("spit", new bot.trigger({
call: /^(\.|\/)spit/i, call: /^(\.|\/)spit/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().split(" "); let args = e.message.trim().split(" ");
args.shift(); args.shift();
args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0]; args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0];
e.replyAction(`spits on [b]${args[0]}[/b] like a dirty whore.`); e.replyAction(`spits on [b]${args[0]}[/b] like a dirty whore.`);
} }
}); }));
bot._trigger.set("assume", { bot._trigger.set("assume", new bot.trigger({
call: /^(\.|\/)assume/i, call: /^(\.|\/)assume/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().split(" "); let args = e.message.trim().split(" ");
args.shift(); args.shift();
args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0]; args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0];
e.reply(`Assuming [b]${args[0]}'s[/b] gender... it's a ${data.genders[~~(Math.random() * data.genders.length)]}.`); e.reply(`Assuming [b]${args[0]}'s[/b] gender... it's a ${data.genders[~~(Math.random() * data.genders.length)]}.`);
} }
}); }));
bot._trigger.set("jn", { bot._trigger.set("jn", new bot.trigger({
call: /^(\.|\/)jn/i, call: /^(\.|\/)jn/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
e.reply(`${e.user.nick}: [b]${~~(Math.random() * 2) ? "Ja" : "Nein"}[/b]`); e.reply(`${e.user.nick}: [b]${~~(Math.random() * 2) ? "Ja" : "Nein"}[/b]`);
} }
}); }));
bot._trigger.set("choose", { bot._trigger.set("choose", new bot.trigger({
call: /^(\.|\/)choose .*/i, call: /^(\.|\/)choose .*/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
const args = e.message.substring(8).trim().split(","); const args = e.message.substring(8).trim().split(",");
if (args.length < 2) if (args.length < 2)
return e.reply(`${e.user.nick}: Ob du behindert bist?`); return e.reply(`${e.user.nick}: Ob du behindert bist?`);
e.reply(`${e.user.nick}: ${args[~~(Math.random() * args.length)].trim()}`); e.reply(`${e.user.nick}: ${args[~~(Math.random() * args.length)].trim()}`);
} }
}); }));
bot._trigger.set("huehuehue", { bot._trigger.set("huehuehue", new bot.trigger({
call: /^huehuehue$/i, call: /^huehuehue$/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
e.reply("huehuehue"); e.reply("huehuehue");
} }
}); }));
bot._trigger.set("woah", { bot._trigger.set("woah", new bot.trigger({
call: /woah/i, call: /woah/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
if (~~(Math.random() * 4)) if (~~(Math.random() * 4))
e.reply(data.woahs[~~(Math.random() * data.woahs.length)]); e.reply(data.woahs[~~(Math.random() * data.woahs.length)]);
} }
}); }));
bot._trigger.set("REEE", { bot._trigger.set("REEE", new bot.trigger({
call: /reee+$/i, call: /reee+$/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
e.reply("R".padEnd(~~(Math.random() * 20 + 10), "E")); e.reply("R".padEnd(~~(Math.random() * 20 + 10), "E"));
} }
}); }));
bot._trigger.set("meme", { bot._trigger.set("meme", new bot.trigger({
call: /^(\.|\/)meme .*/i, call: /^(\.|\/)meme .*/i,
level: 0, active: false,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
const args = e.message.trim().substring(6).split("/"); const args = e.message.trim().substring(6).split("/");
//if(args.length < 3) //if(args.length < 3)
return e.reply("[WIP] too few arguments: .meme [meme] / [line 1] / [line 2]"); return e.reply("[WIP] too few arguments: .meme [meme] / [line 1] / [line 2]");
} }
}); }));
bot._trigger.set("slap", { bot._trigger.set("slap", new bot.trigger({
call: /^(\.|\/)slap/i, call: /^(\.|\/)slap/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().split(" "); let args = e.message.trim().split(" ");
args.shift(); args.shift();
@ -231,16 +185,13 @@ module.exports = bot => {
.replace("{user}", `[b]${args[0]}[/b]`) .replace("{user}", `[b]${args[0]}[/b]`)
); );
} }
}); }));
bot._trigger.set("fw", { bot._trigger.set("fw", new bot.trigger({
call: /^(\.|\/)fw .*/i, call: /^(\.|\/)fw .*/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
const args = e.message.substring(4).trim(); const args = e.message.substring(4).trim();
e.reply(args.toUpperCase().split``.map(c => String.fromCharCode(65312 + (c.charCodeAt(0) - 64))).join``); e.reply(args.toUpperCase().split``.map(c => String.fromCharCode(65312 + (c.charCodeAt(0) - 64))).join``);
} }
}); }));
}; };

View File

@ -19,60 +19,45 @@ Object.keys(data).forEach(cur => {
}); });
module.exports = bot => { module.exports = bot => {
bot._trigger.set("abschieben", { bot._trigger.set("abschieben", new bot.trigger({
call: /^(\.|\/)abschieben/i, call: /^(\.|\/)abschieben/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().split(" "); let args = e.message.trim().split(" ");
args.shift(); args.shift();
args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0]; args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0];
e.replyAction(`schiebt [b]${args[0]}[/b] ${data.abschieben[~~(Math.random() * data.abschieben.length)]} ab.`); e.replyAction(`schiebt [b]${args[0]}[/b] ${data.abschieben[~~(Math.random() * data.abschieben.length)]} ab.`);
} }
}); }));
bot._trigger.set("butterkaese", { bot._trigger.set("butterkaese", new bot.trigger({
call: /^(\.|\/)butterkäse/i, call: /^(\.|\/)butterkäse/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().split(" "); let args = e.message.trim().split(" ");
args.shift(); args.shift();
args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0]; 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 [b]${args[0]}[/b] ein.`); e.replyAction(`drischt mit einem großen Stück Butterkäse auf [b]${args[0]}[/b] ein.`);
} }
}); }));
bot._trigger.set("notschlachten", { bot._trigger.set("notschlachten", new bot.trigger({
call: /^(\.|\/)notschlachten/i, call: /^(\.|\/)notschlachten/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().split(" "); let args = e.message.trim().split(" ");
args.shift(); args.shift();
args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0]; args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0];
e.replyAction(`notschlachtet [b]${args[0]}[/b] und entsorgt die Leiche im Biomüll`); e.replyAction(`notschlachtet [b]${args[0]}[/b] und entsorgt die Leiche im Biomüll`);
} }
}); }));
bot._trigger.set("lachs", { bot._trigger.set("lachs", new bot.trigger({
call: /^(\.|\/)lachs/i, call: /^(\.|\/)lachs/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
e.reply("öhöhöhöhöhöhö"); e.reply("öhöhöhöhöhöhö");
} }
}); }));
bot._trigger.set("kaffee", { bot._trigger.set("kaffee", new bot.trigger({
call: /^(\.|\/)kaffee/i, call: /^(\.|\/)kaffee/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().split(" "); let args = e.message.trim().split(" ");
args.shift(); args.shift();
@ -81,13 +66,10 @@ module.exports = bot => {
.replace("{user}", `[b]${args[0]}[/b]`) .replace("{user}", `[b]${args[0]}[/b]`)
); );
} }
}); }));
bot._trigger.set("tee", { bot._trigger.set("tee", new bot.trigger({
call: /^(\.|\/)tee/i, call: /^(\.|\/)tee/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().split(" "); let args = e.message.trim().split(" ");
args.shift(); args.shift();
@ -96,263 +78,197 @@ module.exports = bot => {
.replace("{user}", `[b]${args[0]}[/b]`) .replace("{user}", `[b]${args[0]}[/b]`)
); );
} }
}); }));
bot._trigger.set("uwe_quotes", { bot._trigger.set("uwe_quotes", new bot.trigger({
call: /^(\.|\/)(boll|firecooler|kinski|stoll)$/i, call: /^(\.|\/)(boll|firecooler|kinski|stoll)$/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().substring(1); let args = e.message.trim().substring(1);
e.reply(data[`quotes_${args}`][~~(Math.random() * data[`quotes_${args}`].length)]); e.reply(data[`quotes_${args}`][~~(Math.random() * data[`quotes_${args}`].length)]);
} }
}); }));
bot._trigger.set("wusel", { bot._trigger.set("wusel", new bot.trigger({
call: /^(\.|\/)wusel/i, call: /^(\.|\/)wusel/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().split(" "); let args = e.message.trim().split(" ");
args.shift(); args.shift();
args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0]; args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0];
e.replyAction(`wuselt [b]${args[0]}[/b] über den Haufen.`); e.replyAction(`wuselt [b]${args[0]}[/b] über den Haufen.`);
} }
}); }));
bot._trigger.set("mett", { bot._trigger.set("mett", new bot.trigger({
call: /^(\.|\/)mett/i, call: /^(\.|\/)mett/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().split(" "); let args = e.message.trim().split(" ");
args.shift(); args.shift();
args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0]; args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0];
e.reply(`Jamba Mettscanner: [b]${args[0]}[/b] ist zu ${~~(Math.random() * 100 + 1)}% Mett.`); e.reply(`Jamba Mettscanner: [b]${args[0]}[/b] ist zu ${~~(Math.random() * 100 + 1)}% Mett.`);
} }
}); }));
bot._trigger.set("rotenburg", { bot._trigger.set("rotenburg", new bot.trigger({
call: /^(\.|\/)rotenburg/i, call: /^(\.|\/)rotenburg/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().split(" "); let args = e.message.trim().split(" ");
args.shift(); args.shift();
args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0]; args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0];
e.replyAction(`verarbeitet [b]${args[0]}[/b] zu Hackfleisch.`); e.replyAction(`verarbeitet [b]${args[0]}[/b] zu Hackfleisch.`);
} }
}); }));
bot._trigger.set("pee", { bot._trigger.set("pee", new bot.trigger({
call: /^(\.|\/)pee/i, call: /^(\.|\/)pee/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().split(" "); let args = e.message.trim().split(" ");
args.shift(); args.shift();
args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0]; args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0];
e.replyAction(`pisst in [b]${args[0]}[/b]s Gesicht.`); e.replyAction(`pisst in [b]${args[0]}[/b]s Gesicht.`);
} }
}); }));
bot._trigger.set("ike", { bot._trigger.set("ike", new bot.trigger({
call: /^ike/i, call: /^ike/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
e.reply("ike ike!"); e.reply("ike ike!");
} }
}); }));
bot._trigger.set("rip", { bot._trigger.set("rip", new bot.trigger({
call: /^rip/i, call: /^rip/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
e.reply("Rust in Peace"); e.reply("Rust in Peace");
} }
}); }));
bot._trigger.set("haram", { bot._trigger.set("haram", new bot.trigger({
call: /^(\.|\/)haram/i, call: /^(\.|\/)haram/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().split(" "); let args = e.message.trim().split(" ");
args.shift(); args.shift();
args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0]; args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0];
e.reply(`[b]${args[0]}[/b] ist ${(~~(Math.random() * 2) ? "haram" : "nicht haram")}.`); e.reply(`[b]${args[0]}[/b] ist ${(~~(Math.random() * 2) ? "haram" : "nicht haram")}.`);
} }
}); }));
bot._trigger.set("sacklutscher", { bot._trigger.set("sacklutscher", new bot.trigger({
call: /^(\.|\/)lutschsack/i, call: /^(\.|\/)lutschsack/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().split(" "); let args = e.message.trim().split(" ");
args.shift(); args.shift();
args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0]; args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0];
e.reply(`[b]${e.user.nick}[/b] legt Rosen aus und lutscht den Sack von [b]${args[0]}[/b]`); e.reply(`[b]${e.user.nick}[/b] legt Rosen aus und lutscht den Sack von [b]${args[0]}[/b]`);
} }
}); }));
bot._trigger.set("kawaii", { bot._trigger.set("kawaii", new bot.trigger({
call: /kawaii/i, call: /kawaii/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
e.reply("⌒(oo) so much kawaii"); e.reply("⌒(oo) so much kawaii");
} }
}); }));
bot._trigger.set("hurrdurr", { bot._trigger.set("hurrdurr", new bot.trigger({
call: /^hurr$/i, call: /^hurr$/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
e.reply("durr"); e.reply("durr");
} }
}); }));
bot._trigger.set("fraguwe", { bot._trigger.set("fraguwe", new bot.trigger({
call: /^uwe.*\?$/i, call: /^uwe.*\?$/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
e.reply("fuck you"); e.reply("fuck you");
} }
}); }));
bot._trigger.set("wasser", { bot._trigger.set("wasser", new bot.trigger({
call: /^(\.|\/)wasser/i, call: /^(\.|\/)wasser/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().split(" "); let args = e.message.trim().split(" ");
args.shift(); args.shift();
args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0]; args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0];
e.replyAction(`kippt [b]${args[0]}[/b] einen Eimer Wasser über den Kopf.`); e.replyAction(`kippt [b]${args[0]}[/b] einen Eimer Wasser über den Kopf.`);
} }
}); }));
bot._trigger.set("normie", { bot._trigger.set("normie", new bot.trigger({
call: /^(\.|\/)normie/i, call: /^(\.|\/)normie/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().split(" "); let args = e.message.trim().split(" ");
args.shift(); args.shift();
args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0]; args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0];
e.reply(`Jamba Normiescanner: [b]${args[0]}[/b] ist zu ${~~(Math.random() * 100 + 1)}% ein Normie.`); e.reply(`Jamba Normiescanner: [b]${args[0]}[/b] ist zu ${~~(Math.random() * 100 + 1)}% ein Normie.`);
} }
}); }));
bot._trigger.set("hyper", { bot._trigger.set("hyper", new bot.trigger({
call: /^(\.|\/)hyper$/i, call: /^(\.|\/)hyper$/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
e.reply("[b]GET HYPER![/b]"); e.reply("[b]GET HYPER![/b]");
} }
}); }));
bot._trigger.set("bark", { bot._trigger.set("bark", new bot.trigger({
call: /^(\.|\/)bark$/i, call: /^(\.|\/)bark$/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
e.reply("BARK BARK BARK"); e.reply("BARK BARK BARK");
} }
}); }));
bot._trigger.set("meditieren", { bot._trigger.set("meditieren", new bot.trigger({
call: /^(\.|\/)meditieren/i, call: /^(\.|\/)meditieren/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().split(" "); let args = e.message.trim().split(" ");
args.shift(); args.shift();
args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0]; args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0];
e.replyAction(`meditiert zusammen mit [b]${args[0]}[/b] Metta.`); e.replyAction(`meditiert zusammen mit [b]${args[0]}[/b] Metta.`);
} }
}); }));
bot._trigger.set("duden", { bot._trigger.set("duden", new bot.trigger({
call: /^(\.|\/)duden/i, call: /^(\.|\/)duden/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().split(" "); let args = e.message.trim().split(" ");
args.shift(); args.shift();
args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0]; args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0];
e.replyAction(`drischt mit einem großen Duden auf [b]${args[0]}[/b] ein.`); e.replyAction(`drischt mit einem großen Duden auf [b]${args[0]}[/b] ein.`);
} }
}); }));
bot._trigger.set("kscht", { bot._trigger.set("kscht", new bot.trigger({
call: /^(\.|\/)kscht/i, call: /^(\.|\/)kscht/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().split(" "); let args = e.message.trim().split(" ");
args.shift(); args.shift();
args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0]; args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0];
e.replyAction(`jagt [b]${args[0]}[/b] durch den Raum.`); e.replyAction(`jagt [b]${args[0]}[/b] durch den Raum.`);
} }
}); }));
bot._trigger.set("bullenpisse", { bot._trigger.set("bullenpisse", new bot.trigger({
call: /^(\.|\/)bullenpisse/i, call: /^(\.|\/)bullenpisse/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().split(" "); let args = e.message.trim().split(" ");
args.shift(); args.shift();
args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0]; args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0];
e.replyAction(`zapft ein Fläschchen feinsten Bullenurin, verarbeitet diesen zu Red-Bull und serviert ihn [b]${args[0]}[/b] in Form einer Pfanddose.`); e.replyAction(`zapft ein Fläschchen feinsten Bullenurin, verarbeitet diesen zu Red-Bull und serviert ihn [b]${args[0]}[/b] in Form einer Pfanddose.`);
} }
}); }));
bot._trigger.set("lungenkrebs", { bot._trigger.set("lungenkrebs", new bot.trigger({
call: /^(\.|\/)lungenkrebs/i, call: /^(\.|\/)lungenkrebs/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().split(" "); let args = e.message.trim().split(" ");
args.shift(); args.shift();
args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0]; args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0];
e.replyAction(`dreht [b]${args[0]}[/b] einen prall gefüllten Sargnagel mit feinstem Schwarzer Krauser.`); e.replyAction(`dreht [b]${args[0]}[/b] einen prall gefüllten Sargnagel mit feinstem Schwarzer Krauser.`);
} }
}); }));
bot._trigger.set("irpg", { bot._trigger.set("irpg", new bot.trigger({
call: /^(\.|\/)irpg/i, call: /^(\.|\/)irpg/i,
level: 0,
active: true,
clients: ["irc", "tg"],
f: e => { f: e => {
let args = e.message.trim().split(" "); let args = e.message.trim().split(" ");
args.shift(); args.shift();
@ -381,18 +297,15 @@ module.exports = bot => {
}); });
} }
}); }));
bot._trigger.set("blah", { bot._trigger.set("blah", new bot.trigger({
call: /^[A-ZÄÖÜẞ](?: [A-ZÄÖÜẞ]){1,5}$/, call: /^[A-ZÄÖÜẞ](?: [A-ZÄÖÜẞ]){1,5}$/,
level: 0,
active: true,
clients: ["irc"], clients: ["irc"],
f: e => { f: e => {
let args = e.message.trim(); let args = e.message.trim();
if (args.toUpperCase() === args) if (args.toUpperCase() === args)
args.substring(2).split(" ").forEach(e.reply); args.substring(2).split(" ").forEach(e.reply);
} }
}); }));
}; };