This commit is contained in:
Flummi 2018-02-28 04:34:52 +01:00
parent 2940b05518
commit 59be967f29
23 changed files with 96 additions and 26 deletions

View File

@ -31,6 +31,9 @@ read().then(() => {
if (!active) if (!active)
continue; continue;
if ((e.self.set !== "all" && e.self.set !== trigger.set) && trigger.set !== "all")
continue;
if (trigger.level > e.user.level.level) { if (trigger.level > e.user.level.level) {
e.reply(`no permission, min level ${trigger.level} required`); e.reply(`no permission, min level ${trigger.level} required`);
break; break;
@ -59,6 +62,7 @@ function trigger(args) {
this.help = args.help || false; this.help = args.help || false;
this.level = args.level || 0; this.level = args.level || 0;
this.active = args.hasOwnProperty("active") ? args.active : true; this.active = args.hasOwnProperty("active") ? args.active : true;
this.set = args.set || "all"; // uwe, nxy, f0ck, all
this.clients = args.clients || ["irc", "tg", "discord"]; this.clients = args.clients || ["irc", "tg", "discord"];
this.f = args.f; this.f = args.f;
} }

View File

@ -1,5 +1,6 @@
import { logger } from "../inc/log"; import { logger } from "../inc/log";
import { getLevel } from "../inc/admin"; import { getLevel } from "../inc/admin";
import { spurdo } from "../inc/spurdo";
import Discord from "discord.js"; import Discord from "discord.js";
import EventEmitter from "events"; import EventEmitter from "events";
@ -9,14 +10,17 @@ export class discord extends EventEmitter {
super(); super();
this.options = options || {}; this.options = options || {};
this.token = options.token || null; this.token = options.token || null;
this.set = this.options.set || "all";
this.bot = new Discord.Client(); this.bot = new Discord.Client();
this.bot.login(this.token); this.bot.login(this.token);
this.server = { this.server = {
set: this.set,
channel: new Map(), channel: new Map(),
user: new Map(), user: new Map(),
me: {} me: {},
spurdo: false
}; };
this.bot.on("ready", () => { this.bot.on("ready", () => {
@ -54,6 +58,7 @@ export class discord extends EventEmitter {
}, },
message: tmp.content, message: tmp.content,
time: ~~(Date.now() / 1000), time: ~~(Date.now() / 1000),
self: this.server,
reply: msg => this.send(tmp, this.format(msg)), reply: msg => this.send(tmp, this.format(msg)),
replyAction: msg => this.send(tmp, this.format(`*${msg}*`), "normal"), replyAction: msg => this.send(tmp, this.format(`*${msg}*`), "normal"),
replyNotice: msg => this.send(tmp, this.format(msg)) replyNotice: msg => this.send(tmp, this.format(msg))
@ -70,6 +75,8 @@ export class discord extends EventEmitter {
} }
} }
format(msg) { format(msg) {
if(this.server.spurdo)
msg = spurdo(msg);
return msg.toString() return msg.toString()
.replace(/\[b\](.*?)\[\/b\]/g, "**$1**") // bold .replace(/\[b\](.*?)\[\/b\]/g, "**$1**") // bold
.replace(/\[i\](.*?)\[\/i\]/g, "*$1*") // italic .replace(/\[i\](.*?)\[\/i\]/g, "*$1*") // italic
@ -78,22 +85,6 @@ export class discord extends EventEmitter {
} }
}; };
/*
Channel:
msg.channel.id
msg.channel.name
Server:
msg.channel.guild.id
msg.channel.guild.name
User:
msg.author.id
msg.author.username
Message:
msg.content (msg.type === "DEFAULT")
*/
Map.prototype.hasi = function(val) { Map.prototype.hasi = function(val) {
for (let [key] of this) for (let [key] of this)
if(key.toLowerCase() === val.toLowerCase()) if(key.toLowerCase() === val.toLowerCase())

View File

@ -39,12 +39,14 @@ export class irc extends EventEmitter {
this.username = this.options.username || "test"; this.username = this.options.username || "test";
this.realname = this.options.realname || "test"; this.realname = this.options.realname || "test";
this.channels = this.options.channels || []; this.channels = this.options.channels || [];
this.set = this.options.set || "all";
this._recachetime = 60 * 30; // 30 minutes this._recachetime = 60 * 30; // 30 minutes
this._cmd = new Map(); this._cmd = new Map();
modules.forEach(mod => mod(this)); modules.forEach(mod => mod(this));
this.server = { this.server = {
set: this.set,
motd: "", motd: "",
me: {}, me: {},
channel: [], channel: [],

View File

@ -11,11 +11,13 @@ export class tg extends EventEmitter {
this.options = options || {}; this.options = options || {};
this.token = options.token || null; this.token = options.token || null;
this.options.pollrate = options.pollrate || 1000; this.options.pollrate = options.pollrate || 1000;
this.set = this.options.set || "all";
this.network = "Telegram"; this.network = "Telegram";
this.api = `https://api.telegram.org/bot${this.token}`; this.api = `https://api.telegram.org/bot${this.token}`;
this.lastUpdate = 0; this.lastUpdate = 0;
this.lastMessage = 0; this.lastMessage = 0;
this.server = { this.server = {
set: this.set,
channel: new Map(), channel: new Map(),
user: new Map(), user: new Map(),
me: {}, me: {},

View File

@ -10,6 +10,7 @@ const _debug = false;
export default bot => { export default bot => {
bot._trigger.set("cfg", new bot.trigger({ bot._trigger.set("cfg", new bot.trigger({
call: /^\!cfg/i, call: /^\!cfg/i,
active: false,
level: 100, level: 100,
clients: ["irc", "discord"], clients: ["irc", "discord"],
f: e => { f: e => {

View File

@ -3,8 +3,7 @@ import cleverbot from "./lib/cleverbot";
export default bot => { export default bot => {
bot._trigger.set("chatbot", new bot.trigger({ bot._trigger.set("chatbot", new bot.trigger({
call: /.*uwe.*/i, call: /.*uwe.*/i,
clients: ["tg", "discord"], set: "uwe",
active: true,
f: e => { f: e => {
const chat = e.message const chat = e.message
.replace(/uwe/gi, "") .replace(/uwe/gi, "")

View File

@ -20,6 +20,7 @@ const markets = {
export default bot => { export default bot => {
bot._trigger.set("coins", new bot.trigger({ bot._trigger.set("coins", new bot.trigger({
call: /^(\.|\/)(btc|eth|xmr|xrp)/i, call: /^(\.|\/)(btc|eth|xmr|xrp)/i,
set: "nxy",
f: e => { f: e => {
let currency = e.args[0] || "eur"; let currency = e.args[0] || "eur";
if(e.cmd === "xrp") if(e.cmd === "xrp")

View File

@ -18,6 +18,7 @@ Object.keys(data).forEach(cur => {
export default bot => { export default bot => {
bot._trigger.set("cookie", new bot.trigger({ bot._trigger.set("cookie", new bot.trigger({
call: /^(\.|\/)cookie/i, call: /^(\.|\/)cookie/i,
set: "nxy",
f: e => { f: e => {
const sayMethod = data.cookie_methods[~~(Math.random() * data.cookie_methods.length)]; const sayMethod = data.cookie_methods[~~(Math.random() * data.cookie_methods.length)];
const sayFlavor = data.cookie_flavors[~~(Math.random() * data.cookie_flavors.length)]; const sayFlavor = data.cookie_flavors[~~(Math.random() * data.cookie_flavors.length)];

View File

@ -4,6 +4,7 @@ import { getLevel, loadAdmins } from "../admin";
export default bot => { export default bot => {
bot._trigger.set("join", new bot.trigger({ bot._trigger.set("join", new bot.trigger({
call: /^\!join .*/i, call: /^\!join .*/i,
active: false,
level: 100, level: 100,
clients: ["irc"], clients: ["irc"],
f: e => { f: e => {
@ -15,6 +16,7 @@ export default bot => {
bot._trigger.set("part", new bot.trigger({ bot._trigger.set("part", new bot.trigger({
call: /^\!part .*/i, call: /^\!part .*/i,
active: false,
level: 100, level: 100,
clients: ["irc"], clients: ["irc"],
f: e => { f: e => {
@ -26,6 +28,7 @@ export default bot => {
bot._trigger.set("nick", new bot.trigger({ bot._trigger.set("nick", new bot.trigger({
call: /^\!nick .*/i, call: /^\!nick .*/i,
active: false,
level: 100, level: 100,
clients: ["irc"], clients: ["irc"],
f: e => { f: e => {
@ -38,6 +41,7 @@ export default bot => {
bot._trigger.set("level", new bot.trigger({ bot._trigger.set("level", new bot.trigger({
call: /^\!level/i, call: /^\!level/i,
active: false,
level: 0, level: 0,
clients: ["irc"], clients: ["irc"],
f: e => { f: e => {

View File

@ -11,6 +11,7 @@ let context = vm.createContext({
export default bot => { export default bot => {
bot._trigger.set("sandbox_debug", new bot.trigger({ bot._trigger.set("sandbox_debug", new bot.trigger({
call: /^\!debug (.*)/i, call: /^\!debug (.*)/i,
active: true,
level: 100, level: 100,
f: e => { f: e => {
const args = e.message.trim().substring(7); const args = e.message.trim().substring(7);

View File

@ -15,6 +15,7 @@ Object.keys(data).forEach(cur => {
export default bot => { export default bot => {
bot._trigger.set("dope", new bot.trigger({ bot._trigger.set("dope", new bot.trigger({
call: /^(\.|\/)dope/i, call: /^(\.|\/)dope/i,
set: "nxy",
help: { help: {
text: "Smoke weed everyday", text: "Smoke weed everyday",
usage: "[b].dope[/b] [i](<nick>)[/i]" usage: "[b].dope[/b] [i](<nick>)[/i]"
@ -32,6 +33,7 @@ export default bot => {
bot._trigger.set("meth", new bot.trigger({ bot._trigger.set("meth", new bot.trigger({
call: /^(\.|\/)meth/i, call: /^(\.|\/)meth/i,
set: "nxy",
help: { help: {
text: "Snort some meth *_*", text: "Snort some meth *_*",
usage: "[b].meth[/b] [i](<nick>)[/i]" usage: "[b].meth[/b] [i](<nick>)[/i]"

View File

@ -4,14 +4,14 @@ export default bot => {
f: e => { f: e => {
if(e.args[0] && [...bot._trigger.keys()].includes(e.args[0])) { if(e.args[0] && [...bot._trigger.keys()].includes(e.args[0])) {
const help = bot._trigger.get(e.args[0]).help; const help = bot._trigger.get(e.args[0]).help;
e.reply(`${help.text}\nusage: ${help.usage}`); e.reply(`(WIP) ${help.text}\nusage: ${help.usage}`);
} }
else { else {
let triggers = []; let triggers = [];
[...bot._trigger.entries()] [...bot._trigger.entries()]
.filter(trigger => trigger[1].help) .filter(trigger => trigger[1].help)
.forEach(trigger => triggers.push(trigger[0])); .forEach(trigger => triggers.push(trigger[0]));
e.reply(`available commands: ${triggers.map(blah => `[b]${blah}[/b]`).join(", ")}`); e.reply(`(WIP) available commands: ${triggers.map(blah => `[b]${blah}[/b]`).join(", ")}`);
} }
} }
})); }));

View File

@ -5,6 +5,7 @@ const feed = "https://www.kernel.org/releases.json";
export default bot => { export default bot => {
bot._trigger.set("kernel", new bot.trigger({ bot._trigger.set("kernel", new bot.trigger({
call: /^(\.|\/)kernel/i, call: /^(\.|\/)kernel/i,
set: "nxy",
f: e => { f: e => {
rp(feed).then(content => { rp(feed).then(content => {
const releases = JSON.parse(content).releases; const releases = JSON.parse(content).releases;

View File

@ -4,6 +4,7 @@ import { cfg } from "../../inc/cfg";
export default bot => { export default bot => {
bot._trigger.set("lastfm", new bot.trigger({ bot._trigger.set("lastfm", new bot.trigger({
call: /^(\.|\/)np/i, call: /^(\.|\/)np/i,
set: "uwe",
/*help: { /*help: {
text: "", text: "",
usage: "[b].np[/b] [i]<user>[/i]" usage: "[b].np[/b] [i]<user>[/i]"

View File

@ -15,8 +15,7 @@ let _query_add = `
export default bot => { export default bot => {
bot._trigger.set("mcmaniac_add", new bot.trigger({ bot._trigger.set("mcmaniac_add", new bot.trigger({
call: /Mc.*iaC/, call: /Mc.*iaC/,
active: true, set: "nxy",
clients: ["irc", "tg"],
f: e => { f: e => {
const match = e.message.match(/(Mc\S+iaC?)/)[0]; const match = e.message.match(/(Mc\S+iaC?)/)[0];
sql.any(_query_add, [match]) sql.any(_query_add, [match])
@ -27,8 +26,7 @@ export default bot => {
bot._trigger.set("mcmaniac_get", new bot.trigger({ bot._trigger.set("mcmaniac_get", new bot.trigger({
call: /^(\.|\/)mcmaniac/i, call: /^(\.|\/)mcmaniac/i,
active: true, set: "nxy",
clients: ["irc", "tg"],
f: e => { f: e => {
const args = e.message.trim().substring(10); const args = e.message.trim().substring(10);
let order = "id asc" let order = "id asc"

View File

@ -25,7 +25,7 @@ insert into nxy_quotes
export default bot => { export default bot => {
bot._trigger.set("quotes", new bot.trigger({ bot._trigger.set("quotes", new bot.trigger({
call: /^(\.|\/)q .*/i, call: /^(\.|\/)q .*/i,
active: true, set: "nxy",
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();

View File

@ -3,6 +3,7 @@ import sql from "../sql";
export default bot => { export default bot => {
bot._trigger.set("rape", new bot.trigger({ bot._trigger.set("rape", new bot.trigger({
call: /^(\.|\/)rape/i, call: /^(\.|\/)rape/i,
set: "nxy",
help: { help: {
text: "Rapes a nick and eventually charge for it", text: "Rapes a nick and eventually charge for it",
usage: "[b].rape[/b] [i](<nick>)[/i]" usage: "[b].rape[/b] [i](<nick>)[/i]"
@ -31,6 +32,7 @@ export default bot => {
bot._trigger.set("owe", new bot.trigger({ bot._trigger.set("owe", new bot.trigger({
call: /^(\.|\/)owe/i, call: /^(\.|\/)owe/i,
set: "nxy",
help: { help: {
text: "Shows how much a nick owes", text: "Shows how much a nick owes",
usage: "[b].owe[/b] [i](<nick>)[/i]" usage: "[b].owe[/b] [i](<nick>)[/i]"

View File

@ -17,6 +17,7 @@ sql.any("select data from useless where trigger = 'sandbox_js'")
export default bot => { export default bot => {
bot._trigger.set("sandbox_js", new bot.trigger({ bot._trigger.set("sandbox_js", new bot.trigger({
call: /^\!js (.*)/i, call: /^\!js (.*)/i,
set: "uwe",
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}`))
@ -56,6 +57,7 @@ export default bot => {
bot._trigger.set("sandbox", new bot.trigger({ 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,
set: "uwe",
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();
@ -70,6 +72,7 @@ export default bot => {
bot._trigger.set("sandbox_rs", new bot.trigger({ bot._trigger.set("sandbox_rs", new bot.trigger({
call: /^\!rs (.*)/i, call: /^\!rs (.*)/i,
set: "uwe",
f: e => { f: e => {
const args = e.message.substring(4); const args = e.message.substring(4);
const params = { const params = {
@ -97,6 +100,7 @@ export default bot => {
bot._trigger.set("bfgen", new bot.trigger({ bot._trigger.set("bfgen", new bot.trigger({
call: /^\!bfgen .*/i, call: /^\!bfgen .*/i,
set: "uwe",
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);

View File

@ -4,6 +4,7 @@ import { cfg } from "../../inc/cfg";
export default bot => { export default bot => {
bot._trigger.set("scrnd", new bot.trigger({ bot._trigger.set("scrnd", new bot.trigger({
call: /^(\.|\/)scrnd/i, call: /^(\.|\/)scrnd/i,
set: "uwe",
help: { help: {
text: "get random track from Flummi's soundcloud favorites", text: "get random track from Flummi's soundcloud favorites",
usage: "[b].scrnd[/b]" usage: "[b].scrnd[/b]"

View File

@ -5,6 +5,7 @@ const url = "https://api.urbandictionary.com/v0/define"
export default bot => { export default bot => {
bot._trigger.set("urbandict", new bot.trigger({ bot._trigger.set("urbandict", new bot.trigger({
call: /^(\.|\/)ud .*/i, call: /^(\.|\/)ud .*/i,
set: "nxy",
help: { help: {
text: "Searches for a term on Urbandict and returns first result", text: "Searches for a term on Urbandict and returns first result",
usage: "[b].ud[/b] [i]<term>[/i] [i](<index>)[/i]" usage: "[b].ud[/b] [i]<term>[/i] [i](<index>)[/i]"

View File

@ -23,6 +23,7 @@ Object.keys(data).forEach(cur => {
export default bot => { export default bot => {
bot._trigger.set("kiss", new bot.trigger({ bot._trigger.set("kiss", new bot.trigger({
call: /^(\.|\/)kiss/i, call: /^(\.|\/)kiss/i,
set: "nxy",
help: { help: {
text: "Kisses a user", text: "Kisses a user",
usage: "[b].kiss[/b] [i](<nick>)[/i]" usage: "[b].kiss[/b] [i](<nick>)[/i]"
@ -34,6 +35,7 @@ export default bot => {
bot._trigger.set("hug", new bot.trigger({ bot._trigger.set("hug", new bot.trigger({
call: /^(\.|\/)hug/i, call: /^(\.|\/)hug/i,
set: "nxy",
help: { help: {
text: "Hugs a user", text: "Hugs a user",
usage: "[b].hug[/b] [i](<nick>)[/i]" usage: "[b].hug[/b] [i](<nick>)[/i]"
@ -45,6 +47,7 @@ export default bot => {
bot._trigger.set("kill", new bot.trigger({ bot._trigger.set("kill", new bot.trigger({
call: /^(\.|\/)kill/i, call: /^(\.|\/)kill/i,
set: "nxy",
f: e => { f: e => {
e.replyAction(data.kill_templates[~~(Math.random() * data.kill_templates.length)] e.replyAction(data.kill_templates[~~(Math.random() * data.kill_templates.length)]
.replace("{user}", `[b]${e.args[0] || e.user.nick}[/b]`) .replace("{user}", `[b]${e.args[0] || e.user.nick}[/b]`)
@ -63,6 +66,7 @@ export default bot => {
bot._trigger.set("yiff", new bot.trigger({ bot._trigger.set("yiff", new bot.trigger({
call: /^(\.|\/)yiff/i, call: /^(\.|\/)yiff/i,
set: "nxy",
f: e => { f: e => {
e.replyAction(data.yiff[~~(Math.random() * data.yiff.length)] e.replyAction(data.yiff[~~(Math.random() * data.yiff.length)]
.split("{user}").join(`[b]${e.args[0] || e.user.nick}[/b]`) .split("{user}").join(`[b]${e.args[0] || e.user.nick}[/b]`)
@ -75,6 +79,7 @@ export default bot => {
bot._trigger.set("bier", new bot.trigger({ bot._trigger.set("bier", new bot.trigger({
call: /^(\.|\/)bier/i, call: /^(\.|\/)bier/i,
set: "nxy",
f: e => { f: e => {
e.replyAction(`schenkt ein kühles Blondes an [b]${e.args[0] || e.user.nick}[/b] aus.`); e.replyAction(`schenkt ein kühles Blondes an [b]${e.args[0] || e.user.nick}[/b] aus.`);
} }
@ -82,6 +87,7 @@ export default bot => {
bot._trigger.set("fucken", new bot.trigger({ bot._trigger.set("fucken", new bot.trigger({
call: /^(\.|\/)fucken/i, call: /^(\.|\/)fucken/i,
set: "nxy",
f: e => { f: e => {
const user = e.args[0] || e.user.nick; const user = e.args[0] || e.user.nick;
e.replyAction(`fuckt [b]${user}[/b] und tötet [b]${user}[/b] anschließend.`); e.replyAction(`fuckt [b]${user}[/b] und tötet [b]${user}[/b] anschließend.`);
@ -90,6 +96,7 @@ export default bot => {
bot._trigger.set("hack", new bot.trigger({ bot._trigger.set("hack", new bot.trigger({
call: /^(\.|\/)hack/i, call: /^(\.|\/)hack/i,
set: "nxy",
f: e => { f: e => {
e.reply(`hacking ${e.args[0] || e.user.nick}...`); e.reply(`hacking ${e.args[0] || e.user.nick}...`);
} }
@ -97,6 +104,7 @@ export default bot => {
bot._trigger.set("spit", new bot.trigger({ bot._trigger.set("spit", new bot.trigger({
call: /^(\.|\/)spit/i, call: /^(\.|\/)spit/i,
set: "nxy",
f: e => { f: e => {
e.replyAction(`spits on [b]${e.args[0] || e.user.nick}[/b] like a dirty whore.`); e.replyAction(`spits on [b]${e.args[0] || e.user.nick}[/b] like a dirty whore.`);
} }
@ -104,6 +112,7 @@ export default bot => {
bot._trigger.set("assume", new bot.trigger({ bot._trigger.set("assume", new bot.trigger({
call: /^(\.|\/)assume/i, call: /^(\.|\/)assume/i,
set: "nxy",
f: e => { f: e => {
e.reply(`Assuming [b]${e.args[0] || e.user.nick}'s[/b] gender... it's a ${data.genders[~~(Math.random() * data.genders.length)]}.`); e.reply(`Assuming [b]${e.args[0] || e.user.nick}'s[/b] gender... it's a ${data.genders[~~(Math.random() * data.genders.length)]}.`);
} }
@ -111,6 +120,7 @@ export default bot => {
bot._trigger.set("jn", new bot.trigger({ bot._trigger.set("jn", new bot.trigger({
call: /^(\.|\/)jn/i, call: /^(\.|\/)jn/i,
set: "nxy",
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]`);
} }
@ -118,6 +128,7 @@ export default bot => {
bot._trigger.set("choose", new bot.trigger({ bot._trigger.set("choose", new bot.trigger({
call: /^(\.|\/)choose .*/i, call: /^(\.|\/)choose .*/i,
set: "nxy",
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)
@ -128,6 +139,7 @@ export default bot => {
bot._trigger.set("huehuehue", new bot.trigger({ bot._trigger.set("huehuehue", new bot.trigger({
call: /^huehuehue$/i, call: /^huehuehue$/i,
set: "nxy",
f: e => { f: e => {
e.reply("huehuehue"); e.reply("huehuehue");
} }
@ -135,6 +147,7 @@ export default bot => {
bot._trigger.set("woah", new bot.trigger({ bot._trigger.set("woah", new bot.trigger({
call: /woah/i, call: /woah/i,
set: "nxy",
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)]);
@ -143,6 +156,7 @@ export default bot => {
bot._trigger.set("REEE", new bot.trigger({ bot._trigger.set("REEE", new bot.trigger({
call: /reee+$/i, call: /reee+$/i,
set: "nxy",
f: e => { f: e => {
e.reply("R".padEnd(~~(Math.random() * 20 + 10), "E")); e.reply("R".padEnd(~~(Math.random() * 20 + 10), "E"));
} }
@ -150,6 +164,7 @@ export default bot => {
bot._trigger.set("meme", new bot.trigger({ bot._trigger.set("meme", new bot.trigger({
call: /^(\.|\/)meme .*/i, call: /^(\.|\/)meme .*/i,
set: "nxy",
active: false, active: false,
f: e => { f: e => {
const args = e.message.trim().substring(6).split("/"); const args = e.message.trim().substring(6).split("/");
@ -161,6 +176,7 @@ export default bot => {
bot._trigger.set("slap", new bot.trigger({ bot._trigger.set("slap", new bot.trigger({
call: /^(\.|\/)slap/i, call: /^(\.|\/)slap/i,
set: "nxy",
f: e => { f: e => {
e.replyAction(data.slap[~~(Math.random() * data.slap.length)] e.replyAction(data.slap[~~(Math.random() * data.slap.length)]
.replace("{user}", `[b]${e.args[0] || e.user.nick}[/b]`) .replace("{user}", `[b]${e.args[0] || e.user.nick}[/b]`)
@ -170,6 +186,7 @@ export default bot => {
bot._trigger.set("fw", new bot.trigger({ bot._trigger.set("fw", new bot.trigger({
call: /^(\.|\/)fw .*/i, call: /^(\.|\/)fw .*/i,
set: "nxy",
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``);
@ -178,6 +195,7 @@ export default bot => {
bot._trigger.set("waifu_husbando", new bot.trigger({ bot._trigger.set("waifu_husbando", new bot.trigger({
call: /^(\.|\/)(waifu|husbando)/i, call: /^(\.|\/)(waifu|husbando)/i,
set: "nxy",
f: e => { f: e => {
let nick = e.args[0] || (e.type === "tg"?e.user.username || e.user.nick:e.user.nick) let nick = e.args[0] || (e.type === "tg"?e.user.username || e.user.nick:e.user.nick)
let mode = e.cmd; let mode = e.cmd;
@ -209,6 +227,7 @@ export default bot => {
bot._trigger.set("asshole", new bot.trigger({ bot._trigger.set("asshole", new bot.trigger({
call: /^(\.|\/)asshole/i, call: /^(\.|\/)asshole/i,
set: "nxy",
f: e => { f: e => {
e.reply(`Jamba Arschlochscanner: [b]${e.args[0] || e.user.nick}[/b] ist zu ${~~(Math.random() * 100 + 1)}% ein Arschloch.`); e.reply(`Jamba Arschlochscanner: [b]${e.args[0] || e.user.nick}[/b] ist zu ${~~(Math.random() * 100 + 1)}% ein Arschloch.`);
} }
@ -216,6 +235,7 @@ export default bot => {
bot._trigger.set("isup", new bot.trigger({ bot._trigger.set("isup", new bot.trigger({
call: /^(\.|\/)isup .*/i, call: /^(\.|\/)isup .*/i,
set: "nxy",
f: e => { f: e => {
const addr = !e.args[0].match(/^https?/g) ? `https://${e.args[0]}` : e.args[0]; const addr = !e.args[0].match(/^https?/g) ? `https://${e.args[0]}` : e.args[0];
rp(addr) rp(addr)
@ -230,6 +250,7 @@ export default bot => {
bot._trigger.set("einschlaefern", new bot.trigger({ bot._trigger.set("einschlaefern", new bot.trigger({
call: /^(\.|\/)einschläfern/i, call: /^(\.|\/)einschläfern/i,
set: "nxy",
f: e => { f: e => {
e.replyAction(`schläfert [b]${e.args[0] || e.user.nick}[/b] mit einer Spritze Ketamin ein.`); e.replyAction(`schläfert [b]${e.args[0] || e.user.nick}[/b] mit einer Spritze Ketamin ein.`);
} }
@ -237,6 +258,7 @@ export default bot => {
bot._trigger.set("witz", new bot.trigger({ bot._trigger.set("witz", new bot.trigger({
call: /^(\.|\/)witz$/i, call: /^(\.|\/)witz$/i,
set: "nxy",
f: e => { f: e => {
rp("http://www.funny4you.at/webmasterprogramm/zufallswitz.php?id=312") rp("http://www.funny4you.at/webmasterprogramm/zufallswitz.php?id=312")
.then(res => { .then(res => {
@ -270,6 +292,7 @@ export default bot => {
bot._trigger.set("joke", new bot.trigger({ bot._trigger.set("joke", new bot.trigger({
call: /^(\.|\/)joke$/i, call: /^(\.|\/)joke$/i,
set: "nxy",
f: e => { f: e => {
rp("https://icanhazdadjoke.com/slack", { json: true }) rp("https://icanhazdadjoke.com/slack", { json: true })
.then(res => { .then(res => {

View File

@ -23,6 +23,7 @@ Object.keys(data).forEach(cur => {
export default bot => { export default bot => {
bot._trigger.set("abschieben", new bot.trigger({ bot._trigger.set("abschieben", new bot.trigger({
call: /^(\.|\/)abschieben/i, call: /^(\.|\/)abschieben/i,
set: "uwe",
f: e => { f: e => {
e.replyAction(`schiebt [b]${e.args[0] || e.user.nick}[/b] ${data.abschieben[~~(Math.random() * data.abschieben.length)]} ab.`); e.replyAction(`schiebt [b]${e.args[0] || e.user.nick}[/b] ${data.abschieben[~~(Math.random() * data.abschieben.length)]} ab.`);
} }
@ -30,6 +31,7 @@ export default bot => {
bot._trigger.set("butterkaese", new bot.trigger({ bot._trigger.set("butterkaese", new bot.trigger({
call: /^(\.|\/)butterkäse/i, call: /^(\.|\/)butterkäse/i,
set: "uwe",
f: e => { f: e => {
e.replyAction(`drischt mit einem großen Stück Butterkäse auf [b]${e.args[0] || e.user.nick}[/b] ein.`); e.replyAction(`drischt mit einem großen Stück Butterkäse auf [b]${e.args[0] || e.user.nick}[/b] ein.`);
} }
@ -37,6 +39,7 @@ export default bot => {
bot._trigger.set("notschlachten", new bot.trigger({ bot._trigger.set("notschlachten", new bot.trigger({
call: /^(\.|\/)notschlachten/i, call: /^(\.|\/)notschlachten/i,
set: "uwe",
f: e => { f: e => {
e.replyAction(`notschlachtet [b]${e.args[0] || e.user.nick}[/b] und entsorgt die Leiche im Biomüll`); e.replyAction(`notschlachtet [b]${e.args[0] || e.user.nick}[/b] und entsorgt die Leiche im Biomüll`);
} }
@ -44,6 +47,7 @@ export default bot => {
bot._trigger.set("lachs", new bot.trigger({ bot._trigger.set("lachs", new bot.trigger({
call: /^(\.|\/)lachs/i, call: /^(\.|\/)lachs/i,
set: "uwe",
f: e => { f: e => {
e.reply("öhöhöhöhöhöhö"); e.reply("öhöhöhöhöhöhö");
} }
@ -51,6 +55,7 @@ export default bot => {
bot._trigger.set("kaffee", new bot.trigger({ bot._trigger.set("kaffee", new bot.trigger({
call: /^(\.|\/)kaffee/i, call: /^(\.|\/)kaffee/i,
set: "uwe",
f: e => { f: e => {
e.replyAction(data.kaffee[~~(Math.random() * data.kaffee.length)] e.replyAction(data.kaffee[~~(Math.random() * data.kaffee.length)]
.replace("{user}", `[b]${e.args[0] || e.user.nick}[/b]`) .replace("{user}", `[b]${e.args[0] || e.user.nick}[/b]`)
@ -60,6 +65,7 @@ export default bot => {
bot._trigger.set("tee", new bot.trigger({ bot._trigger.set("tee", new bot.trigger({
call: /^(\.|\/)tee/i, call: /^(\.|\/)tee/i,
set: "uwe",
f: e => { f: e => {
e.replyAction(data.tee[~~(Math.random() * data.tee.length)] e.replyAction(data.tee[~~(Math.random() * data.tee.length)]
.replace("{user}", `[b]${e.args[0] || e.user.nick}[/b]`) .replace("{user}", `[b]${e.args[0] || e.user.nick}[/b]`)
@ -69,6 +75,7 @@ export default bot => {
bot._trigger.set("uwe_quotes", new bot.trigger({ bot._trigger.set("uwe_quotes", new bot.trigger({
call: /^(\.|\/)(boll|firecooler|kinski|stoll)$/i, call: /^(\.|\/)(boll|firecooler|kinski|stoll)$/i,
set: "uwe",
f: e => { f: e => {
e.reply(data[`quotes_${e.cmd}`][~~(Math.random() * data[`quotes_${e.cmd}`].length)]); e.reply(data[`quotes_${e.cmd}`][~~(Math.random() * data[`quotes_${e.cmd}`].length)]);
} }
@ -76,6 +83,7 @@ export default bot => {
bot._trigger.set("wusel", new bot.trigger({ bot._trigger.set("wusel", new bot.trigger({
call: /^(\.|\/)wusel/i, call: /^(\.|\/)wusel/i,
set: "uwe",
f: e => { f: e => {
e.replyAction(`wuselt [b]${e.args[0] || e.user.nick}[/b] über den Haufen.`); e.replyAction(`wuselt [b]${e.args[0] || e.user.nick}[/b] über den Haufen.`);
} }
@ -83,6 +91,7 @@ export default bot => {
bot._trigger.set("mett", new bot.trigger({ bot._trigger.set("mett", new bot.trigger({
call: /^(\.|\/)mett/i, call: /^(\.|\/)mett/i,
set: "uwe",
f: e => { f: e => {
e.reply(`Jamba Mettscanner: [b]${e.args[0] || e.user.nick}[/b] ist zu ${~~(Math.random() * 100 + 1)}% Mett.`); e.reply(`Jamba Mettscanner: [b]${e.args[0] || e.user.nick}[/b] ist zu ${~~(Math.random() * 100 + 1)}% Mett.`);
} }
@ -90,6 +99,7 @@ export default bot => {
bot._trigger.set("rotenburg", new bot.trigger({ bot._trigger.set("rotenburg", new bot.trigger({
call: /^(\.|\/)rotenburg/i, call: /^(\.|\/)rotenburg/i,
set: "uwe",
f: e => { f: e => {
e.replyAction(`verarbeitet [b]${e.args[0] || e.user.nick}[/b] zu Hackfleisch.`); e.replyAction(`verarbeitet [b]${e.args[0] || e.user.nick}[/b] zu Hackfleisch.`);
} }
@ -97,6 +107,7 @@ export default bot => {
bot._trigger.set("pee", new bot.trigger({ bot._trigger.set("pee", new bot.trigger({
call: /^(\.|\/)pee/i, call: /^(\.|\/)pee/i,
set: "uwe",
f: e => { f: e => {
e.replyAction(`pisst in [b]${e.args[0] || e.user.nick}[/b]s Gesicht.`); e.replyAction(`pisst in [b]${e.args[0] || e.user.nick}[/b]s Gesicht.`);
} }
@ -104,6 +115,7 @@ export default bot => {
bot._trigger.set("ike", new bot.trigger({ bot._trigger.set("ike", new bot.trigger({
call: /^ike/i, call: /^ike/i,
set: "uwe",
f: e => { f: e => {
e.reply("ike ike!"); e.reply("ike ike!");
} }
@ -111,6 +123,7 @@ export default bot => {
bot._trigger.set("rip", new bot.trigger({ bot._trigger.set("rip", new bot.trigger({
call: /^rip/i, call: /^rip/i,
set: "uwe",
f: e => { f: e => {
e.reply("Rust in Peace"); e.reply("Rust in Peace");
} }
@ -118,6 +131,7 @@ export default bot => {
bot._trigger.set("haram", new bot.trigger({ bot._trigger.set("haram", new bot.trigger({
call: /^(\.|\/)haram/i, call: /^(\.|\/)haram/i,
set: "uwe",
f: e => { f: e => {
e.reply(`[b]${e.args[0] || e.user.nick}[/b] ist ${(~~(Math.random() * 2) ? "haram" : "nicht haram")}.`); e.reply(`[b]${e.args[0] || e.user.nick}[/b] ist ${(~~(Math.random() * 2) ? "haram" : "nicht haram")}.`);
} }
@ -125,6 +139,7 @@ export default bot => {
bot._trigger.set("sacklutscher", new bot.trigger({ bot._trigger.set("sacklutscher", new bot.trigger({
call: /^(\.|\/)lutschsack/i, call: /^(\.|\/)lutschsack/i,
set: "uwe",
f: e => { f: e => {
e.reply(`[b]${e.user.nick}[/b] legt Rosen aus und lutscht den Sack von [b]${e.args[0] || e.user.nick}[/b]`); e.reply(`[b]${e.user.nick}[/b] legt Rosen aus und lutscht den Sack von [b]${e.args[0] || e.user.nick}[/b]`);
} }
@ -132,6 +147,7 @@ export default bot => {
bot._trigger.set("kawaii", new bot.trigger({ bot._trigger.set("kawaii", new bot.trigger({
call: /kawaii/i, call: /kawaii/i,
set: "uwe",
f: e => { f: e => {
e.reply("⌒(oo) so much kawaii"); e.reply("⌒(oo) so much kawaii");
} }
@ -139,6 +155,7 @@ export default bot => {
bot._trigger.set("hurrdurr", new bot.trigger({ bot._trigger.set("hurrdurr", new bot.trigger({
call: /^hurr$/i, call: /^hurr$/i,
set: "uwe",
f: e => { f: e => {
e.reply("durr"); e.reply("durr");
} }
@ -146,6 +163,7 @@ export default bot => {
bot._trigger.set("fraguwe", new bot.trigger({ bot._trigger.set("fraguwe", new bot.trigger({
call: /^uwe.*\?$/i, call: /^uwe.*\?$/i,
set: "uwe",
active: false, active: false,
f: e => { f: e => {
e.reply("fuck you"); e.reply("fuck you");
@ -154,6 +172,7 @@ export default bot => {
bot._trigger.set("wasser", new bot.trigger({ bot._trigger.set("wasser", new bot.trigger({
call: /^(\.|\/)wasser/i, call: /^(\.|\/)wasser/i,
set: "uwe",
f: e => { f: e => {
e.replyAction(`kippt [b]${e.args[0] || e.user.nick}[/b] einen Eimer Wasser über den Kopf.`); e.replyAction(`kippt [b]${e.args[0] || e.user.nick}[/b] einen Eimer Wasser über den Kopf.`);
} }
@ -161,6 +180,7 @@ export default bot => {
bot._trigger.set("normie", new bot.trigger({ bot._trigger.set("normie", new bot.trigger({
call: /^(\.|\/)normie/i, call: /^(\.|\/)normie/i,
set: "uwe",
f: e => { f: e => {
e.reply(`Jamba Normiescanner: [b]${e.args[0] || e.user.nick}[/b] ist zu ${~~(Math.random() * 100 + 1)}% ein Normie.`); e.reply(`Jamba Normiescanner: [b]${e.args[0] || e.user.nick}[/b] ist zu ${~~(Math.random() * 100 + 1)}% ein Normie.`);
} }
@ -168,6 +188,7 @@ export default bot => {
bot._trigger.set("hyper", new bot.trigger({ bot._trigger.set("hyper", new bot.trigger({
call: /^(\.|\/)hyper$/i, call: /^(\.|\/)hyper$/i,
set: "uwe",
f: e => { f: e => {
e.reply("[b]GET HYPER![/b]"); e.reply("[b]GET HYPER![/b]");
} }
@ -175,6 +196,7 @@ export default bot => {
bot._trigger.set("bark", new bot.trigger({ bot._trigger.set("bark", new bot.trigger({
call: /^(\.|\/)bark$/i, call: /^(\.|\/)bark$/i,
set: "uwe",
f: e => { f: e => {
e.reply("BARK BARK BARK"); e.reply("BARK BARK BARK");
} }
@ -182,6 +204,7 @@ export default bot => {
bot._trigger.set("meditieren", new bot.trigger({ bot._trigger.set("meditieren", new bot.trigger({
call: /^(\.|\/)meditieren/i, call: /^(\.|\/)meditieren/i,
set: "uwe",
f: e => { f: e => {
e.replyAction(`meditiert zusammen mit [b]${e.args[0] || e.user.nick}[/b] Metta.`); e.replyAction(`meditiert zusammen mit [b]${e.args[0] || e.user.nick}[/b] Metta.`);
} }
@ -189,6 +212,7 @@ export default bot => {
bot._trigger.set("duden", new bot.trigger({ bot._trigger.set("duden", new bot.trigger({
call: /^(\.|\/)duden/i, call: /^(\.|\/)duden/i,
set: "uwe",
f: e => { f: e => {
e.replyAction(`drischt mit einem großen Duden auf [b]${e.args[0] || e.user.nick}[/b] ein.`); e.replyAction(`drischt mit einem großen Duden auf [b]${e.args[0] || e.user.nick}[/b] ein.`);
} }
@ -196,6 +220,7 @@ export default bot => {
bot._trigger.set("kscht", new bot.trigger({ bot._trigger.set("kscht", new bot.trigger({
call: /^(\.|\/)kscht/i, call: /^(\.|\/)kscht/i,
set: "uwe",
f: e => { f: e => {
e.replyAction(`jagt [b]${e.args[0] || e.user.nick}[/b] durch den Raum.`); e.replyAction(`jagt [b]${e.args[0] || e.user.nick}[/b] durch den Raum.`);
} }
@ -203,6 +228,7 @@ export default bot => {
bot._trigger.set("bullenpisse", new bot.trigger({ bot._trigger.set("bullenpisse", new bot.trigger({
call: /^(\.|\/)bullenpisse/i, call: /^(\.|\/)bullenpisse/i,
set: "uwe",
f: e => { f: e => {
e.replyAction(`zapft ein Fläschchen feinsten Bullenurin, verarbeitet diesen zu Red-Bull und serviert ihn [b]${e.args[0] || e.user.nick}[/b] in Form einer Pfanddose.`); e.replyAction(`zapft ein Fläschchen feinsten Bullenurin, verarbeitet diesen zu Red-Bull und serviert ihn [b]${e.args[0] || e.user.nick}[/b] in Form einer Pfanddose.`);
} }
@ -210,6 +236,7 @@ export default bot => {
bot._trigger.set("lungenkrebs", new bot.trigger({ bot._trigger.set("lungenkrebs", new bot.trigger({
call: /^(\.|\/)lungenkrebs/i, call: /^(\.|\/)lungenkrebs/i,
set: "uwe",
f: e => { f: e => {
e.replyAction(`dreht [b]${e.args[0] || e.user.nick}[/b] einen prall gefüllten Sargnagel mit feinstem Schwarzer Krauser.`); e.replyAction(`dreht [b]${e.args[0] || e.user.nick}[/b] einen prall gefüllten Sargnagel mit feinstem Schwarzer Krauser.`);
} }
@ -217,6 +244,7 @@ export default bot => {
bot._trigger.set("irpg", new bot.trigger({ bot._trigger.set("irpg", new bot.trigger({
call: /^(\.|\/)irpg/i, call: /^(\.|\/)irpg/i,
set: "uwe",
f: e => { f: e => {
const user = e.args[0] || e.user.nick; const user = e.args[0] || e.user.nick;
rp("http://idlerpg.rizon.net/players.php").then(top => { rp("http://idlerpg.rizon.net/players.php").then(top => {
@ -246,6 +274,7 @@ export default bot => {
bot._trigger.set("blah", new bot.trigger({ bot._trigger.set("blah", new bot.trigger({
call: /^[A-ZÄÖÜẞ](?: [A-ZÄÖÜẞ]){1,5}$/, call: /^[A-ZÄÖÜẞ](?: [A-ZÄÖÜẞ]){1,5}$/,
set: "uwe",
clients: ["irc"], clients: ["irc"],
f: e => { f: e => {
let args = e.message.trim(); let args = e.message.trim();

View File

@ -3,6 +3,7 @@ import rp from "request-promise";
export default bot => { export default bot => {
bot._trigger.set("wttr", new bot.trigger({ bot._trigger.set("wttr", new bot.trigger({
call: /^\.wttr .*/i, call: /^\.wttr .*/i,
set: "uwe",
help: { help: {
text: "Gets the weather from wttr.in", text: "Gets the weather from wttr.in",
usage: "[b].wttr[/b] [i]<location>[/i]" usage: "[b].wttr[/b] [i]<location>[/i]"
@ -64,6 +65,7 @@ export default bot => {
bot._trigger.set("weather", new bot.trigger({ bot._trigger.set("weather", new bot.trigger({
call: /^(\.|\/)weather .*/i, call: /^(\.|\/)weather .*/i,
set: "nxy",
help: { help: {
text: "Gets the weather from Yahoo weather API", text: "Gets the weather from Yahoo weather API",
usage: "[b].weather[/b] [i]<location>[/i]" usage: "[b].weather[/b] [i]<location>[/i]"