rewrite trigger system

This commit is contained in:
Flummi 2019-08-19 01:28:01 +00:00
parent 22d79eed18
commit 3a751f2e52
30 changed files with 536 additions and 570 deletions

View File

@ -1,12 +1,12 @@
import logger from "./inc/log";
import _fs from "fs";
import { read, cfg } from "./inc/cfg";
import { default as config } from "../cfg/config.json";
import triggers from "./inc/trigger";
import events from "./inc/events";
import cuffeo from "cuffeo";
const fs = _fs.promises;
const timeout = 1000;
(async () => {
await read(); // read and parse config from database
@ -24,6 +24,35 @@ import cuffeo from "cuffeo";
bot: new cuffeo(config.clients)
};
triggers.forEach(mod => mod(self));
events.forEach(event => event(self));
console.time("loading");
const modules = {
events: (await fs.readdir("./src/inc/events")).filter(f => f.endsWith(".mjs")),
trigger: (await fs.readdir("./src/inc/trigger")).filter(f => f.endsWith(".mjs"))
};
console.timeLog("loading", "directories");
const blah = (await Promise.all(Object.entries(modules).map(async ([dir, mods]) => ({
[dir]: (await Promise.all(mods.map(async mod => {
const res = await Promise.race([
(await import(`./inc/${dir}/${mod}`)).default(self),
new Promise((_, rej) => setTimeout(() => rej(false), timeout))
]);
console.timeLog("loading", `${dir}/${mod}`);
return res;
}))).flat(2)
})))).reduce((a, b) => ({...a, ...b}));
blah.events.forEach(event => {
console.timeLog("loading", `registering event > ${event.name}`);
self.bot.on(event.listener, event.f);
});
blah.trigger.forEach(trigger => {
console.timeLog("loading", `registering trigger > ${trigger.name}`);
self._trigger.set(trigger.name, new self.trigger(trigger));
});
console.timeEnd("loading");
})();

View File

@ -1,16 +1,21 @@
import logger from "../log";
const versions = [
"AmIRC.1 (8 Bit) for Commodore Amiga 500",
"HexChat 0.72 [x86] / Windows 95c [500MHz]"
];
export default self => {
self.bot.on("ctcp:version", e => {
e.write(`notice ${e.user.nick} :\u0001VERSION ${versions[~~(Math.random() * versions.length)]}\u0001`);
});
export default async bot => {
self.bot.on("ctcp:ping", e => {
e.write(`notice ${e.user.nick} :${e.message}`);
});
return [{
name: "version",
listener: "ctcp:version",
f: e => {
e.write(`notice ${e.user.nick} :\u0001VERSION ${versions[~~(Math.random() * versions.length)]}\u0001`);
}
}, {
name: "ping",
listner: "ctcp:ping",
f: e => {
e.write(`notice ${e.user.nick} :${e.message}`);
}
}];
};

View File

@ -1,5 +1,5 @@
import logger from "../log";
import { read, cfg } from "../cfg";
import { cfg } from "../cfg";
import { getLevel } from "../../inc/admin";
@ -12,40 +12,34 @@ const parseArgs = (msg) => {
};
};
export default self => {
self.bot.on("message", e => {
for (var [name, trigger] of self._trigger.entries()) {
//if (!e.self.me.nickname) {
// e.reply("nope, still initialising myself :^)");
// break;
//}
if (!trigger.call.exec(e.message))
continue;
if (!trigger.clients.includes(e.type))
continue;
export default async bot => {
let active = false;
if (e.type === "irc" && cfg.trigger[e.network + e.channel]) {
if (cfg.trigger[e.network + e.channel][trigger.name])
active = true;
}
else
active = trigger.active;
if (!active)
continue;
return [{
name: "message",
listener: "message",
f: e => {
const trigger = [...bot._trigger.entries()].filter(t =>
t[1].call.exec(e.message) &&
t[1].clients.includes(e.type) &&
t[1].active &&
!(t[1].level > getLevel(e.network, e.user)) &&
!((e.self.set !== "all" && e.self.set !== t[1].set) && t[1].set !== "all")
);
if ((e.self.set !== "all" && e.self.set !== trigger.set) && trigger.set !== "all")
continue;
trigger.forEach(async t => {
try {
e = { ...e, ...parseArgs(e.message) };
await t[1].f(e);
console.log(`triggered > ${t[0]}`);
}
catch(error) {
e.reply("An error occured.");
logger.error(`${e.network} -> ${e.channel} -> ${e.user.nick}: ${typeof error === "string" ? error : JSON.stringify(error)}`);
}
});
//if (trigger.level > e.user.level.level) {
if (trigger.level > getLevel(e.network, e.user)) {
e.reply(`no permission, min level ${trigger.level} required`);
break;
}
e = Object.assign(e, parseArgs(e.message));
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}`);
});
}];
};

View File

@ -0,0 +1,16 @@
import logger from "../log";
const versions = [
"AmIRC.1 (8 Bit) for Commodore Amiga 500",
"HexChat 0.72 [x86] / Windows 95c [500MHz]"
];
export default self => {
self.bot.on("ctcp:version", e => {
e.write(`notice ${e.user.nick} :\u0001VERSION ${versions[~~(Math.random() * versions.length)]}\u0001`);
});
self.bot.on("ctcp:ping", e => {
e.write(`notice ${e.user.nick} :${e.message}`);
});
};

View File

@ -0,0 +1,51 @@
import logger from "../log";
import { read, cfg } from "../cfg";
import { getLevel } from "../../inc/admin";
const parseArgs = (msg) => {
let args = msg.trim().split(" ");
let cmd = args.shift();
return {
cmd: cmd.replace(/^(\.|\/|\!)/, ""),
args: args
};
};
export default self => {
self.bot.on("message", e => {
for (var [name, trigger] of self._trigger.entries()) {
//if (!e.self.me.nickname) {
// e.reply("nope, still initialising myself :^)");
// break;
//}
if (!trigger.call.exec(e.message))
continue;
if (!trigger.clients.includes(e.type))
continue;
let active = false;
if (e.type === "irc" && cfg.trigger[e.network + e.channel]) {
if (cfg.trigger[e.network + e.channel][trigger.name])
active = true;
}
else
active = trigger.active;
if (!active)
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 > getLevel(e.network, e.user)) {
e.reply(`no permission, min level ${trigger.level} required`);
break;
}
e = Object.assign(e, parseArgs(e.message));
trigger.f(e);
}
logger.info(`${e.network} -> ${e.channel} -> ${e.user.nick}: ${e.message}`);
});
};

View File

@ -7,12 +7,14 @@ const _opts = {
};
const _debug = false;
export default bot => {
bot._trigger.set("cfg", new bot.trigger({
export default async bot => {
return [{
name: "cfg",
call: /^\!cfg/i,
active: false,
level: 100,
clients: ["irc", "discord"],
clients: ["irc"],
f: e => {
let args = e.message.substring(5);
let opts = {};
@ -91,5 +93,5 @@ export default bot => {
}
}
}));
}];
};

View File

@ -1,7 +1,8 @@
import cleverbot from "./lib/cleverbot";
export default async bot => {
const cleverbot = (await import("./lib/cleverbot")).default;
export default bot => {
bot._trigger.set("chatbot", new bot.trigger({
return [{
name: "chatbot",
call: /^(?![!./[])(.*uw(e|i).*)/i,
set: "uwe",
f: e => {
@ -12,10 +13,7 @@ export default bot => {
cleverbot.ask(chat)
.then(res => {
e.reply(res.response);
})
.catch(err => {
console.log(err);
});
}).catch(console.error);
}
}));
}]
};

View File

@ -16,9 +16,29 @@ const markets = {
xmr: "bitfinex",
xrp: "poloniex"
};
const cryptowat_summary = (crypto, market, currency) => new Promise((resolve, reject) => {
if (!Object.keys(currencies).includes(currency) || crypto === currency)
reject(`Can't convert or invalid currency: ${currency}`);
fetch([{ market: market, crypto: crypto, currency: currency }].map(api_url).join``)
.then(res => res.json())
.then(res => {
if (res.length === 0)
reject("No data received");
const data = {
last: [{ val: res.result.price.last }].map(currencies[currency]).join``,
high: [{ val: res.result.price.high }].map(currencies[currency]).join``,
low: [{ val: res.result.price.low }].map(currencies[currency]).join``,
change: (res.result.price.change.percentage * 100).toFixed(2),
volume: res.result.volume
};
resolve(`Current: [b]${data.last}[/b] - High: [b]${data.high}[/b] - Low: [b]${data.low}[/b] - Change: [b]${data.change}[/b]% - Volume: [b]${data.volume}[/b]`);
}).catch(err => reject("lol cryptowatch ist down"));
});
export default bot => {
bot._trigger.set("coins", new bot.trigger({
export default async bot => {
return [{
name: "coins",
call: /^(\.|\/)(btc|eth|xmr|xrp)/i,
set: "nxy",
f: e => {
@ -31,26 +51,5 @@ export default bot => {
reject => e.reply(reject)
);
}
}));
};
const cryptowat_summary = (crypto, market, currency) => {
return new Promise((resolve, reject) => {
if (!Object.keys(currencies).includes(currency) || crypto === currency)
reject(`Can't convert or invalid currency: ${currency}`);
fetch([{ market: market, crypto: crypto, currency: currency }].map(api_url).join``)
.then(res => res.json())
.then(res => {
if (res.length === 0)
reject("No data received");
const data = {
last: [{ val: res.result.price.last }].map(currencies[currency]).join``,
high: [{ val: res.result.price.high }].map(currencies[currency]).join``,
low: [{ val: res.result.price.low }].map(currencies[currency]).join``,
change: (res.result.price.change.percentage * 100).toFixed(2),
volume: res.result.volume
};
resolve(`Current: [b]${data.last}[/b] - High: [b]${data.high}[/b] - Low: [b]${data.low}[/b] - Change: [b]${data.change}[/b]% - Volume: [b]${data.volume}[/b]`);
}).catch(err => reject("lol cryptowatch ist down"));
});
}];
};

View File

@ -8,15 +8,16 @@ const data = {
cookie_beverages: [],
};
Object.keys(data).forEach(cur => {
sql.any("select data from useless where trigger = $1 limit 1", [cur])
.then(rows => {
data[cur] = JSON.parse(rows[0].data);
});
});
export default async bot => {
Object.keys(data).forEach(cur => {
sql.any("select data from useless where trigger = $1 limit 1", [cur])
.then(rows => {
data[cur] = JSON.parse(rows[0].data);
});
});
export default bot => {
bot._trigger.set("cookie", new bot.trigger({
return [{
name: "cookie",
call: /^(\.|\/)cookie/i,
set: "nxy",
f: e => {
@ -28,5 +29,5 @@ export default bot => {
e.reply(`Here, I'll ${sayMethod} you a ${sayFlavor} ${saySize} ${sayCookie} cookie with a side of ${sayBev}.`);
}
}));
}];
};

View File

@ -1,8 +1,10 @@
import sql from "../sql";
import { getLevel } from "../admin";
export default bot => {
bot._trigger.set("join", new bot.trigger({
export default async bot => {
return [{
name: "join",
call: /^\!join .*/i,
level: 100,
clients: ["irc"],
@ -13,9 +15,8 @@ export default bot => {
e.reply(`joined channel${chans.length > 1 ? "s" : ""}: ${chans.join(", ")}`);
}
}
}));
bot._trigger.set("part", new bot.trigger({
}, {
name: "part",
call: /^\!part .*/i,
level: 100,
clients: ["irc"],
@ -26,9 +27,8 @@ export default bot => {
e.reply(`parted channel${chans.length > 1 ? "s" : ""}: ${chans.join(", ")}`);
}
}
}));
bot._trigger.set("nick", new bot.trigger({
}, {
name: "nick",
call: /^\!nick .*/i,
level: 100,
clients: ["irc"],
@ -40,9 +40,8 @@ export default bot => {
e.reply(`changed nick to ${e.args[0]}`);
}
}
}));
bot._trigger.set("level", new bot.trigger({
}, {
name: "level",
call: /^\!level .*/i,
level: 0,
active: false,
@ -108,5 +107,5 @@ export default bot => {
}
}
}
}));
}]
};

View File

@ -11,10 +11,13 @@ let context = vm.createContext({
fetch: fetch,
console: console
});
export default bot => {
bot._trigger.set("sandbox_debug", new bot.trigger({
export default async bot => {
return [{
name: "sandbox_debug",
call: /^\!debug (.*)/i,
active: false,
active: true,
level: 100,
f: e => {
const args = e.message.trim().substring(7);
@ -35,5 +38,5 @@ export default bot => {
e.reply(err.message);
}
}
}));
}];
};

View File

@ -5,15 +5,16 @@ const data = {
dope_strains: {}
};
Object.keys(data).forEach(cur => {
sql.any("select data from useless where trigger = $1 limit 1", [cur])
.then(rows => {
data[cur] = JSON.parse(rows[0].data);
});
});
export default async bot => {
Object.keys(data).forEach(cur => {
sql.any("select data from useless where trigger = $1 limit 1", [cur])
.then(rows => {
data[cur] = JSON.parse(rows[0].data);
});
});
export default bot => {
bot._trigger.set("dope", new bot.trigger({
return [{
name: "dope",
call: /^(\.|\/)dope/i,
set: "nxy",
help: {
@ -29,9 +30,8 @@ export default bot => {
, strain = data.dope_strains[strain_type][~~(Math.random() * data.dope_strains[strain_type].length)];
e.replyAction(`${action[0]} a ${consume_type} of the finest ${strain_type} "${strain}" ${action[1]} [b]${e.args[0] || e.user.nick}[/b]`);
}
}));
bot._trigger.set("meth", new bot.trigger({
}, {
name: "meth",
call: /^(\.|\/)meth/i,
set: "nxy",
help: {
@ -41,5 +41,5 @@ export default bot => {
f: e => {
e.replyAction(`legt [b]${e.args[0] || e.user.nick}[/b] eine dicke Line Meth \\________`);
}
}));
}];
};

View File

@ -1,6 +1,9 @@
export default bot => {
bot._trigger.set("help", new bot.trigger({
export default async bot => {
return [{
name: "help",
call: /^(\.|\/)help/i,
active: false,
f: e => {
if(e.args[0] && [...bot._trigger.keys()].includes(e.args[0])) {
const help = bot._trigger.get(e.args[0]).help;
@ -15,5 +18,5 @@ export default bot => {
e.reply(`(WIP) available commands: ${triggers.map(blah => `[b]${blah}[/b]`).join(", ")}`);
}
}
}));
}];
};

View File

@ -1,29 +0,0 @@
import cfg from "./cfg";
import chatbot from "./chatbot";
import coins from "./coins";
import cookie from "./cookie";
import core from "./core";
import debug from "./debug";
import drugs from "./drugs";
import help from "./help";
import irpg from "./irpg";
import kernel from "./kernel";
import lastfm from "./lastfm";
import mcmaniac from "./mcmaniac";
import pr0gag from "./pr0gag";
import quotes from "./quotes";
import rape from "./rape";
import sandbox from "./sandbox";
import soundcloud from "./soundcloud";
import sysinfo from "./sysinfo";
import urban from "./urban";
import nxy from "./useless_nxy";
import uwe from "./useless_uwe";
import wttr from "./wttr";
export default [
cfg, chatbot, coins, cookie, core, debug,
drugs, help, irpg, kernel, lastfm, mcmaniac,
pr0gag, quotes, rape, sandbox, soundcloud,
sysinfo, urban, nxy, uwe, wttr
];

View File

@ -1,11 +1,12 @@
import fetch from "flumm-fetch-cookies";
export default bot => {
bot._trigger.set("irpg", new bot.trigger({
export default async bot => {
return [{
name: "irpg",
call: /^\.irpg/i,
set: "uwe",
f: e => {
//process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;
fetch("https://f0ck.me/irpg/db.php")
.then(res => res.text())
.then(res => {
@ -51,5 +52,5 @@ export default bot => {
})
.catch(err => console.log(err));
}
}));
}];
};

View File

@ -2,8 +2,10 @@ import fetch from "flumm-fetch-cookies";
const feed = "https://www.kernel.org/releases.json";
export default bot => {
bot._trigger.set("kernel", new bot.trigger({
export default async bot => {
return [{
name: "kernel",
call: /^(\.|\/)kernel/i,
set: "nxy",
f: e => {
@ -14,5 +16,5 @@ export default bot => {
e.reply(releases.map(entry => `[b]${entry.version}[/b] (${entry.moniker}${entry.iseol ? `, [i]EOL[/i]` : ""})`).join(", "));
}).catch(err => console.log(err));
}
}));
}
}];
};

View File

@ -1,35 +1,43 @@
import { cfg } from "../../inc/cfg";
import fetch from "flumm-fetch-cookies";
export default bot => {
bot._trigger.set("lastfm", new bot.trigger({
const api = `http://ws.audioscrobbler.com/2.0/?method=user.getRecentTracks&limit=1&api_key=${cfg.main.lastfm.val.key}&format=json&user=`;
export default async bot => {
return [{
name: "lastfm",
call: /^(\.|\/)np/i,
set: "uwe",
/*help: {
text: "",
usage: "[b].np[/b] [i]<user>[/i]"
},*/
f: e => {
const api = `http://ws.audioscrobbler.com/2.0/?method=user.getRecentTracks&limit=1&api_key=${cfg.main.lastfm.val.key}&format=json&user=`;
f: async e => {
const nick = e.args[0] || e.user.nick;
fetch(`${api}${nick}`)
.then(res => res.json())
.then(res => {
if(res.error)
return e.reply("User not found");
res = res.recenttracks;
const track = res.track[0];
const info = {
user: res["@attr"].user,
track: `${track.artist["#text"]} - ${track.name}`,
playing: track["@attr"] ? true : false
};
if(info.playing)
e.reply( `[b]${info.user}[/b] is listening to [b]${info.track}[/b]` );
else
e.reply( `[b]${info.user}[/b] is not listening to anything. They last listened to [b]${info.track}[/b]` );
}).catch(err => console.log(err));
let res = await (await fetch(`${api}${nick}`)).json();
if(res.error) return {
err: true,
msg: "User not found"
};
res = res.recenttracks;
const track = res.track[0];
const info = {
user: res["@attr"].user,
track: `${track.artist["#text"]} - ${track.name}`,
playing: track["@attr"] ? true : false
};
return {
err: false,
mode: "normal",
msg: info.playing ?
`[b]${info.user}[/b] is listening to [b]${info.track}[/b]` :
`[b]${info.user}[/b] is not listening to anything. They last listened to [b]${info.track}[/b]`
};
}
}));
}];
};

View File

@ -1,11 +1,11 @@
import fetch from "flumm-fetch-cookies";
import { cfg } from "../../../inc/cfg";
class cleverbot {
export default new class cleverbot {
constructor() {
this.api = "https://cleverbot.io/1.0";
this.nick = "";
setTimeout(() => this.init(), 5000);
this.init();
}
init() {
@ -41,5 +41,3 @@ class cleverbot {
});
}
};
export default new cleverbot();

View File

@ -12,8 +12,10 @@ let _query_add = `
insert into mcmaniacs (item) values ($1) on conflict do nothing
`;
export default bot => {
bot._trigger.set("mcmaniac_add", new bot.trigger({
export default async bot => {
return [{
name: "mcmaniac_add",
call: /Mc.*iaC/,
set: "nxy",
f: e => {
@ -22,9 +24,8 @@ export default bot => {
.then()
.catch(err => {});
}
}));
bot._trigger.set("mcmaniac_get", new bot.trigger({
}, {
name: "mcmaniac_get",
call: /^(\.|\/)mcmaniac/i,
set: "nxy",
f: e => {
@ -59,5 +60,5 @@ export default bot => {
console.log(err);
});
}
}));
}];
};

View File

@ -33,70 +33,67 @@ const regex = {
return res.json();
}).then(console.log);*/
export default bot => {
bot._trigger.set("pr0gag", new bot.trigger({
export default async bot => {
await fetch("https://google.de");
return [{
name: "pr0gag",
call: /pr0gramm\.com\/.+\/.+/i,
set: "uwe",
f: async e => {
let reply;
try {
let matches, id;
if(matches = e.message.match(regex.direct)) {
const path = matches[1] === "full" && matches[3] === "png"
let matches, id, link, list;
if(matches = e.message.match(regex.direct)) {
const path = matches[1] === "full" && matches[3] === "png"
? matches[2].slice(0, -3) + "jpg"
: matches[2];
const response = await (await fetch(apis.reverse + path)).json();
if(response.error || !response.items.length)
throw "reverse lookup error";
id = response.items[0].id;
}
else if(matches = e.message.match(regex.normal))
id = matches[1];
else
return;
let [list, info] = await Promise.all([
fetch(apis.list + id),
fetch(apis.item + id)
].map(async request => (await request).json()));
list = list.items.filter(item => item.id == id)[0]; // ja, == ist hier ein muss!
if(!list || !info || !Array.isArray(info.tags) || !Array.isArray(info.comments))
throw "item lookup error";
const toptags = info.tags
.sort((a, b) => b.confidence - a.confidence)
.slice(0, 3)
.map(tag => tag.tag)
.join(", ");
const voteRatio = list.up / (list.up + list.down);
const voteRatioColors = [
"red",
"brown",
"orange",
"yellow",
"green",
"lightgreen",
];
const voteRatioColor = voteRatioColors[~~Math.min(voteRatio * voteRatioColors.length, voteRatioColors.length - 1)];
reply = [
"https://pr0gramm.com/" + (list.promoted ? "top" : "new") + "/" + id,
`${list.up - list.down} (${color.green(list.up)} / ${color.red(list.down)} = ${color[voteRatioColor]((voteRatio * 100).toFixed(1))}${color.magenta("%")})`,
"user: " + list.user,
"comments: " + info.comments.length,
`toptags: ${toptags} (${flags[list.flags]})`
].join(" - ");
const response = await (await fetch(apis.reverse + path)).json();
if(response.error || !response.items.length)
throw "reverse lookup error";
list = response.item[0];
id = list.id;
link = "https://pr0gramm.com/" + (list.promoted ? "top" : "new") + "/" + id;
}
catch(error) {
reply = typeof error === "string" ? error : JSON.stringify(error);
}
finally {
reply && e.reply(reply);
else if(matches = e.message.match(regex.normal)) {
id = matches[1];
link = matches[0];
list = (await (await fetch(apis.list + id)).json())
.items
.filter(item => item.id == id)[0];
}
else
return;
let info = await (await fetch(apis.item + id)).json();
if(!info || !Array.isArray(info.tags) || !Array.isArray(info.comments))
throw "item lookup error";
const toptags = info.tags
.sort((a, b) => b.confidence - a.confidence)
.slice(0, 3)
.map(tag => tag.tag)
.join(", ");
const voteRatio = list.up / (list.up + list.down);
const voteRatioColors = [
"red",
"brown",
"orange",
"yellow",
"green",
"lightgreen",
];
const voteRatioColor = voteRatioColors[~~Math.min(voteRatio * voteRatioColors.length, voteRatioColors.length - 1)];
e.reply([
"https://pr0gramm.com/" + (list.promoted ? "top" : "new") + "/" + id,
`${list.up - list.down} (${color.green(list.up)} / ${color.red(list.down)} = ${color[voteRatioColor]((voteRatio * 100).toFixed(1))}${color.magenta("%")})`,
"user: " + list.user,
"comments: " + info.comments.length,
`toptags: ${toptags} (${flags[list.flags]})`
].join(" - "));
}
}));
}];
};

View File

@ -23,8 +23,10 @@ insert into nxy_quotes
($1, $2, $3, $4);
`;
export default bot => {
bot._trigger.set("qrnd", new bot.trigger({
export default async bot => {
return [{
name: "qrnd",
call: /^(\.|\/)q(rnd)?$/i,
set: "all",
f: e => {
@ -35,8 +37,8 @@ export default bot => {
e.reply(`<[b]${quote.nick}[/b]> [i]${quote.item}[/i]`);
}).catch(console.error);
}
}));
bot._trigger.set("quotes", new bot.trigger({
}, {
name: "quotes",
call: /^(\.|\/)q .*/i,
set: "nxy",
f: e => {
@ -118,5 +120,5 @@ export default bot => {
break;
}
}
}));
}];
};

View File

@ -1,7 +1,9 @@
import sql from "../sql";
export default bot => {
bot._trigger.set("rape", new bot.trigger({
export default async bot => {
return [{
name: "rape",
call: /^(\.|\/)rape/i,
set: "nxy",
help: {
@ -28,9 +30,8 @@ export default bot => {
});
}
}
}));
bot._trigger.set("owe", new bot.trigger({
}, {
name: "owe",
call: /^(\.|\/)owe/i,
set: "nxy",
help: {
@ -53,5 +54,5 @@ export default bot => {
return e.reply("user not found");
});
}
}));
}];
};

View File

@ -6,14 +6,14 @@ import fetch from "flumm-fetch-cookies";
import stringify from "stringify-object";
let _contexts = new Map();
setTimeout(() => {
export default async bot => {
sql.any("select prefix, sandbox from nxy_users where sandbox != 'NULL'")
.then(rows => rows.forEach(row => eval(`_contexts.set(row.prefix, ${JSON.parse(row.sandbox)});`)))
.catch(err => console.log("nichts vorhanden lol", err));
}, 5000);
export default bot => {
bot._trigger.set("sandbox_js", new bot.trigger({
return [{
name: "sandbox_js",
call: /^(\.|\/)js (.*)/i,
set: "uwe",
f: e => {
@ -50,9 +50,8 @@ export default bot => {
e.reply(e.user.nick + ": " + err.message.length > maxoutput ? `holy fuck, Error wäre viel zu lang! (${err.message.length} Zeichen :DDDDDD)` : JSON.stringify(err.message));
}
}
}));
bot._trigger.set("sandbox", new bot.trigger({
}, {
name: "sandbox",
call: /^\!(hs|py|cpp|bf|php|lua|bash) .*/i,
set: "uwe",
f: e => {
@ -65,9 +64,8 @@ export default bot => {
reject => e.reply(reject.replace("\n", " "))
);
}
}));
bot._trigger.set("sandbox_rs", new bot.trigger({
}, {
name: "sandbox_rs",
call: /^\!rs (.*)/i,
set: "uwe",
f: e => {
@ -90,9 +88,8 @@ export default bot => {
e.reply(e.user.nick + ": " + body.success ? (body.stdout.length > maxoutput ? `holy fuck, Ausgabe wäre viel zu lang! (${body.stdout.length} Zeichen :DDDDDD)` : body.stdout) : "error!");
}).catch(err => e.reply(err));
}
}));
bot._trigger.set("bfgen", new bot.trigger({
}, {
name: "bfgen",
call: /^\!bfgen .*/i,
set: "uwe",
f: e => {
@ -100,5 +97,5 @@ export default bot => {
let output = bfgen(args);
e.reply(e.user.nick + ": " + output.length > maxoutput ? `holy fuck, Ausgabe wäre viel zu lang! (${output.length} Zeichen :DDDDDD)` : output);
}
}));
}];
};

View File

@ -1,8 +1,10 @@
import fetch from "flumm-fetch-cookies";
import { cfg } from "../../inc/cfg";
export default bot => {
bot._trigger.set("scrnd", new bot.trigger({
export default async bot => {
return [{
name: "scrnd",
call: /^(\.|\/)scrnd/i,
set: "uwe",
help: {
@ -17,5 +19,5 @@ export default bot => {
e.reply(`${track.permalink_url}\n[b]${track.title}[/b] - length [b]${track.duration}[/b] - [b]${track.user.username}[/b] on [b]${track.created_at}[/b]`);
}).catch(err => console.log(err));
}
}));
}];
};

View File

@ -1,7 +1,9 @@
import cp from "child_process";
export default bot => {
bot._trigger.set("sysinfo", new bot.trigger({
export default async bot => {
return [{
name: "sysinfo",
call: /^(\.|\/)sysinfo/i,
set: "uwe",
f: e => {
@ -9,5 +11,5 @@ export default bot => {
e.reply(stdout);
});
}
}));
}];
};

View File

@ -2,8 +2,10 @@ import fetch from "flumm-fetch-cookies";
const url = "https://api.urbandictionary.com/v0/define"
export default bot => {
bot._trigger.set("urbandict", new bot.trigger({
export default async bot => {
return [{
name: "urbandict",
call: /^(\.|\/)ud .*/i,
set: "nxy",
help: {
@ -27,5 +29,5 @@ export default bot => {
e.reply(`[${index}/${data.list.length}] [b]${res.word}[/b]: ${res.definition.replace(/\r\n/g, "")} - ${res.example.replace(/\r\n/g, "")}`);
}).catch(err => console.log(err));
}
}));
}];
};

View File

@ -10,18 +10,14 @@ const data = {
slap: []
};
Object.keys(data).forEach(cur => {
sql.any("select data from useless where trigger = $1 limit 1", [cur])
.then(rows => {
data[cur] = JSON.parse(rows[0].data);
})
.catch(err => {
console.log(err);
});
});
export default async bot => {
export default bot => {
bot._trigger.set("kiss", new bot.trigger({
Object.keys(data).forEach(cur => sql.any("select data from useless where trigger = $1 limit 1", [cur])
.then(rows => data[cur] = JSON.parse(rows[0].data))
.catch(console.error));
return [{
name: "kiss",
call: /^(\.|\/)kiss/i,
set: "nxy",
help: {
@ -31,9 +27,8 @@ export default bot => {
f: e => {
e.reply(`(づ。◕‿‿◕。)づ" [color=red]。。・゜゜・。。・゜❤[/color] [b]${e.args[0] || e.user.nick}[/b] [color=red]❤[/color]`);
}
}));
bot._trigger.set("hug", new bot.trigger({
}, {
name: "hug",
call: /^(\.|\/)hug/i,
set: "nxy",
help: {
@ -43,9 +38,8 @@ export default bot => {
f: e => {
e.reply(`[color=red]♥♡❤♡♥[/color] [b]${e.args[0] || e.user.nick}[/b] [color=red]♥♡❤♡♥[/color]`);
}
}));
bot._trigger.set("kill", new bot.trigger({
}, {
name: "kill",
call: /^(\.|\/)kill/i,
set: "nxy",
f: e => {
@ -62,9 +56,8 @@ export default bot => {
.replace("{bomb}", data.kill_parts.bomb[~~(Math.random() * data.kill_parts.bomb.length)])
);
}
}));
bot._trigger.set("yiff", new bot.trigger({
}, {
name: "yiff",
call: /^(\.|\/)yiff/i,
set: "nxy",
f: e => {
@ -75,58 +68,51 @@ export default bot => {
.split("{channel}").join(`${e.channel}`)
);
}
}));
bot._trigger.set("bier", new bot.trigger({
}, {
name: "bier",
call: /^(\.|\/)bier/i,
set: "nxy",
f: e => {
e.replyAction(`schenkt ein kühles Blondes an [b]${e.args[0] || e.user.nick}[/b] aus.`);
}
}));
bot._trigger.set("fucken", new bot.trigger({
}, {
name: "fucken",
call: /^(\.|\/)fucken/i,
set: "nxy",
f: e => {
const user = e.args[0] || e.user.nick;
e.replyAction(`fuckt [b]${user}[/b] und tötet [b]${user}[/b] anschließend.`);
}
}));
bot._trigger.set("hack", new bot.trigger({
}, {
name: "hack",
call: /^(\.|\/)hack/i,
set: "nxy",
f: e => {
e.reply(`hacking ${e.args[0] || e.user.nick}...`);
}
}));
bot._trigger.set("spit", new bot.trigger({
}, {
name: "spit",
call: /^(\.|\/)spit/i,
set: "nxy",
f: e => {
e.replyAction(`spits on [b]${e.args[0] || e.user.nick}[/b] like a dirty whore.`);
}
}));
bot._trigger.set("assume", new bot.trigger({
}, {
name: "assume",
call: /^(\.|\/)assume/i,
set: "nxy",
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)]}.`);
}
}));
bot._trigger.set("jn", new bot.trigger({
}, {
name: "jn",
call: /^(\.|\/)jn/i,
set: "nxy",
f: e => {
e.reply(`${e.user.nick}: [b]${~~(Math.random() * 2) ? "Ja" : "Nein"}[/b]`);
}
}));
bot._trigger.set("choose", new bot.trigger({
}, {
name: "chosse",
call: /^(\.|\/)choose .*/i,
set: "nxy",
f: e => {
@ -135,34 +121,30 @@ export default bot => {
return e.reply(`${e.user.nick}: Ob du behindert bist?`);
e.reply(`${e.user.nick}: ${args[~~(Math.random() * args.length)].trim()}`);
}
}));
bot._trigger.set("huehuehue", new bot.trigger({
}, {
name: "huehuehue",
call: /^huehuehue$/i,
set: "nxy",
f: e => {
e.reply("huehuehue");
}
}));
bot._trigger.set("woah", new bot.trigger({
}, {
name: "woah",
call: /woah/i,
set: "nxy",
f: e => {
if (~~(Math.random() * 4))
e.reply(data.woahs[~~(Math.random() * data.woahs.length)]);
}
}));
bot._trigger.set("REEE", new bot.trigger({
}, {
name: "REEE",
call: /reee+$/i,
set: "nxy",
f: e => {
e.reply("R".padEnd(~~(Math.random() * 20 + 10), "E"));
}
}));
bot._trigger.set("meme", new bot.trigger({
}, {
name: "meme",
call: /^(\.|\/)meme .*/i,
set: "nxy",
active: false,
@ -172,9 +154,8 @@ export default bot => {
return e.reply("[WIP] too few arguments: .meme [meme] / [line 1] / [line 2]");
}
}));
bot._trigger.set("slap", new bot.trigger({
}, {
name: "slap",
call: /^(\.|\/)slap/i,
set: "nxy",
f: e => {
@ -182,18 +163,16 @@ export default bot => {
.replace("{user}", `[b]${e.args[0] || e.user.nick}[/b]`)
);
}
}));
bot._trigger.set("fw", new bot.trigger({
}, {
name: "fw",
call: /^(\.|\/)fw .*/i,
set: "nxy",
f: e => {
const args = e.message.substring(4).trim();
e.reply([...args.toUpperCase()].map(c => c === ' ' ? ' ' : String.fromCharCode(65248 + c.charCodeAt(0))).join``);
}
}));
bot._trigger.set("waifu_husbando", new bot.trigger({
}, {
name: "waifu_husbando",
call: /^(\.|\/)(waifu|husbando)/i,
set: "nxy",
f: e => {
@ -224,17 +203,15 @@ export default bot => {
.catch(err => console.log(err));
}
}
}));
bot._trigger.set("asshole", new bot.trigger({
}, {
name: "asshole",
call: /^(\.|\/)asshole/i,
set: "nxy",
f: e => {
e.reply(`Jamba Arschlochscanner: [b]${e.args[0] || e.user.nick}[/b] ist zu ${~~(Math.random() * 100 + 1)}% ein Arschloch.`);
}
}));
bot._trigger.set("isup", new bot.trigger({
}, {
name: "isup",
call: /^(\.|\/)isup .*/i,
set: "nxy",
f: e => {
@ -247,13 +224,12 @@ export default bot => {
e.reply(`[b]${addr}[/b] seems to be [b]down[/b].`);
});
}
}));
bot._trigger.set("einschlaefern", new bot.trigger({
}, {
name: "einschlaefern",
call: /^(\.|\/)einschläfern/i,
set: "nxy",
f: e => {
e.replyAction(`schläfert [b]${e.args[0] || e.user.nick}[/b] mit einer Spritze Ketamin ein.`);
}
}));
}];
};

View File

@ -12,334 +12,250 @@ const data = {
quotes_boll: []
};
Object.keys(data).forEach(cur => {
sql.any("select data from useless where trigger = $1 limit 1", [cur])
.then(rows => {
data[cur] = JSON.parse(rows[0].data);
});
});
export default async bot => {
export default bot => {
bot._trigger.set("abschieben", new bot.trigger({
Object.keys(data).forEach(cur => sql.any("select data from useless where trigger = $1 limit 1", [cur])
.then(rows => data[cur] = JSON.parse(rows[0].data))
.catch(console.error));
return [{
name: "abschieben",
call: /^(\.|\/)abschieben/i,
set: "uwe",
f: e => {
e.replyAction(`schiebt [b]${e.args[0] || e.user.nick}[/b] ${data.abschieben[~~(Math.random() * data.abschieben.length)]} ab.`);
}
}));
bot._trigger.set("butterkaese", new bot.trigger({
}, {
name: "butterkäse",
call: /^(\.|\/)butterkäse/i,
set: "uwe",
f: e => {
e.replyAction(`drischt mit einem großen Stück Butterkäse auf [b]${e.args[0] || e.user.nick}[/b] ein.`);
}
}));
bot._trigger.set("notschlachten", new bot.trigger({
}, {
name: "notschlachten",
call: /^(\.|\/)notschlachten/i,
set: "uwe",
f: e => {
e.replyAction(`notschlachtet [b]${e.args[0] || e.user.nick}[/b] und entsorgt die Leiche im Biomüll`);
}
}));
bot._trigger.set("lachs", new bot.trigger({
}, {
name: "lachs",
call: /^(\.|\/)lachs/i,
set: "uwe",
f: e => {
e.reply("öhöhöhöhöhöhö");
}
}));
bot._trigger.set("kaffee", new bot.trigger({
}, {
name: "kaffee",
call: /^(\.|\/)kaffee/i,
set: "uwe",
f: e => {
e.replyAction(data.kaffee[~~(Math.random() * data.kaffee.length)]
.replace("{user}", `[b]${e.args[0] || e.user.nick}[/b]`)
);
e.replyAction(data.kaffee[~~(Math.random() * data.kaffee.length)].replace("{user}", `[b]${e.args[0] || e.user.nick}[/b]`));
}
}));
bot._trigger.set("milch", new bot.trigger({
}, {
name: "milch",
call: /^(\.|\/)milch/i,
set: "uwe",
f: e => {
e.replyAction(data.milch[~~(Math.random() * data.milch.length)]
.replace("{user}", `[b]${e.args[0] || e.user.nick}[/b]`)
);
e.replyAction(data.milch[~~(Math.random() * data.milch.length)].replace("{user}", `[b]${e.args[0] || e.user.nick}[/b]`));
}
}));
bot._trigger.set("milchkaffee", new bot.trigger({
}, {
name: "milchkaffee",
call: /^(\.|\/)milchkaffee/i,
set: "uwe",
f: e => {
e.replyAction(`serviert [b]${e.args[0] || e.user.nick}[/b] einen heißen halbschwarzen Kaffee mit 99% Kondensmilchanteil.`);
}
}));
bot._trigger.set("oh", new bot.trigger({
call: /^doch$/i,
set: "uwe",
f: e => {
if(e.user.nick === "nxy")
e.reply("oh!");
}
}));
bot._trigger.set("tee", new bot.trigger({
}, {
name: "tee",
call: /^(\.|\/)tee/i,
set: "uwe",
f: e => {
e.replyAction(data.tee[~~(Math.random() * data.tee.length)]
.replace("{user}", `[b]${e.args[0] || e.user.nick}[/b]`)
);
e.replyAction(data.tee[~~(Math.random() * data.tee.length)].replace("{user}", `[b]${e.args[0] || e.user.nick}[/b]`));
}
}));
bot._trigger.set("uwe_quotes", new bot.trigger({
}, {
name: "uwe_quotes",
call: /^(\.|\/)(boll|firecooler|kinski|stoll)$/i,
set: "uwe",
f: e => {
e.reply(data[`quotes_${e.cmd}`][~~(Math.random() * data[`quotes_${e.cmd}`].length)]);
}
}));
bot._trigger.set("wusel", new bot.trigger({
}, {
name:"wusel",
call: /^(\.|\/)wusel/i,
set: "uwe",
f: e => {
e.replyAction(`wuselt [b]${e.args[0] || e.user.nick}[/b] über den Haufen.`);
}
}));
bot._trigger.set("mett", new bot.trigger({
}, {
name: "mett",
call: /^(\.|\/)mett/i,
set: "uwe",
f: e => {
e.reply(`Jamba Mettscanner: [b]${e.args[0] || e.user.nick}[/b] ist zu ${~~(Math.random() * 100 + 1)}% Mett.`);
}
}));
bot._trigger.set("unfaehig", new bot.trigger({
}, {
name: "unfaehig",
call: /^(\.|\/)unfähig/i,
set: "uwe",
f: e => {
e.reply(`Jamba Fähigkeitenscanner: [b]${e.args[0] || e.user.nick}[/b] ist zu ${~~(Math.random() * 100 + 1)}% unfähig.`);
}
}));
bot._trigger.set("rotenburg", new bot.trigger({
}, {
name: "rotenburg",
call: /^(\.|\/)rotenburg/i,
set: "uwe",
f: e => {
e.replyAction(`verarbeitet [b]${e.args[0] || e.user.nick}[/b] zu Hackfleisch.`);
}
}));
bot._trigger.set("pee", new bot.trigger({
}, {
name: "pee",
call: /^(\.|\/)pee/i,
set: "uwe",
f: e => {
e.replyAction(`pisst in [b]${e.args[0] || e.user.nick}[/b]s Gesicht.`);
}
}));
bot._trigger.set("ike", new bot.trigger({
}, {
name: "ike",
call: /^ike/i,
set: "uwe",
f: e => {
e.reply("ike ike!");
}
}));
bot._trigger.set("rip", new bot.trigger({
}, {
name: "rip",
call: /^rip/i,
set: "uwe",
f: e => {
e.reply("Rust in Pitabrot");
}
}));
bot._trigger.set("haram", new bot.trigger({
}, {
name: "haram",
call: /^(\.|\/)haram/i,
set: "uwe",
f: e => {
e.reply(`[b]${e.args[0] || e.user.nick}[/b] ist ${(~~(Math.random() * 2) ? "haram" : "nicht haram")}.`);
}
}));
bot._trigger.set("sacklutscher", new bot.trigger({
}, {
name: "sacklutscher",
call: /^(\.|\/)lutschsack/i,
set: "uwe",
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]`);
}
}));
bot._trigger.set("kawaii", new bot.trigger({
}, {
name: "kawaii",
call: /kawaii/i,
set: "uwe",
f: e => {
e.reply("⌒(oo) so much kawaii");
}
}));
bot._trigger.set("hurrdurr", new bot.trigger({
}, {
name: "hurrdurr",
call: /^hurr$/i,
set: "uwe",
f: e => {
e.reply("durr");
}
}));
bot._trigger.set("fraguwe", new bot.trigger({
call: /^uwe.*\?$/i,
}, {
name: "herpderp",
call: /^herp$/i,
set: "uwe",
active: false,
f: e => {
e.reply("fuck you");
e.reply("derp");
}
}));
bot._trigger.set("wasser", new bot.trigger({
}, {
name: "wasser",
call: /^(\.|\/)wasser/i,
set: "uwe",
f: e => {
e.replyAction(`kippt [b]${e.args[0] || e.user.nick}[/b] einen Eimer Wasser über den Kopf.`);
}
}));
bot._trigger.set("normie", new bot.trigger({
}, {
name: "normie",
call: /^(\.|\/)normie/i,
set: "uwe",
f: e => {
e.reply(`Jamba Normiescanner: [b]${e.args[0] || e.user.nick}[/b] ist zu ${~~(Math.random() * 100 + 1)}% ein Normie.`);
}
}));
bot._trigger.set("hyper", new bot.trigger({
}, {
name: "hyper",
call: /^(\.|\/)hyper$/i,
set: "uwe",
f: e => {
e.reply("[b]GET HYPER![/b]");
}
}));
bot._trigger.set("bark", new bot.trigger({
}, {
name: "bark",
call: /^(\.|\/)bark$/i,
set: "uwe",
f: e => {
e.reply("BARK BARK BARK");
}
}));
bot._trigger.set("meditieren", new bot.trigger({
}, {
name: "meditieren",
call: /^(\.|\/)meditieren/i,
set: "uwe",
f: e => {
e.replyAction(`meditiert zusammen mit [b]${e.args[0] || e.user.nick}[/b] Metta.`);
}
}));
bot._trigger.set("duden", new bot.trigger({
}, {
name: "duden",
call: /^(\.|\/)duden/i,
set: "uwe",
f: e => {
e.replyAction(`drischt mit einem großen Duden auf [b]${e.args[0] || e.user.nick}[/b] ein.`);
}
}));
bot._trigger.set("kscht", new bot.trigger({
}, {
name: "kscht",
call: /^(\.|\/)kscht/i,
set: "uwe",
f: e => {
e.replyAction(`jagt [b]${e.args[0] || e.user.nick}[/b] durch den Raum.`);
}
}));
bot._trigger.set("bullenpisse", new bot.trigger({
}, {
name: "bullenpisse",
call: /^(\.|\/)bullenpisse/i,
set: "uwe",
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.`);
}
}));
bot._trigger.set("lungenkrebs", new bot.trigger({
}, {
name: "lungenkrebs",
call: /^(\.|\/)lungenkrebs/i,
set: "uwe",
f: e => {
e.replyAction(`dreht [b]${e.args[0] || e.user.nick}[/b] einen prall gefüllten Sargnagel mit feinstem Schwarzer Krauser.`);
}
}));
bot._trigger.set("blah", new bot.trigger({
}, {
name: "blah",
call: /^[A-ZÄÖÜẞ](?: [A-ZÄÖÜẞ]){1,5}$/,
set: "uwe",
clients: ["irc"],
f: e => {
let args = e.message.trim();
if (args.toUpperCase() === args)
args.substring(2).split(" ").forEach(e.reply);
if (args.toUpperCase() === args) e.reply(args.substring(2).split(" ").join("\n"));
}
}));
bot._trigger.set("rose", new bot.trigger({
}, {
name: "rose",
call: /^(\.|\/)rose/i,
set: "uwe",
f: e => {
e.replyAction(`schenkt [b]${e.args[0] || e.user.nick}[/b] eine [color=red]~~{~[@}[/color]`);
}
}));
bot._trigger.set("wienerle", new bot.trigger({
}, {
name: "wienerle",
call: /^(\.|\/)wienerle/i,
set: "uwe",
f: e => {
e.replyAction(`serviert [b]${e.args[0] || e.user.nick}[/b] ein kaltes Wienerle mit etwas Wurstwasser.`);
}
}));
bot._trigger.set("witz", new bot.trigger({
call: /^(\.|\/)witz$/i,
set: "uwe",
f: e => {
fetch("http://www.funny4you.at/webmasterprogramm/zufallswitz.php?id=312")
.then(res => res.text())
.then(res => {
res = res
.split("<br />").join("")
.split("<div class=\"funny4you\">").join("")
.split("&amp;").join("&")
.split("&auml;").join("ä")
.split("&ouml;").join("ö")
.split("&uuml;").join("ü")
.split("&Auml;").join("Ä")
.split("&Ouml;").join("Ö")
.split("&Uuml;").join("Ü")
.split("&szlig;").join("ß")
.split("&quot;").join("\"")
.replace(/\<span.*/i, "");
if(e.network !== "Telegram") {
res
.match(/.{1,450}/g)
.map(e.reply);
}
else
e.reply(res);
}).catch(err => console.log(err));
}
}));
bot._trigger.set("joke", new bot.trigger({
}, {
name: "joke",
call: /^(\.|\/)joke$/i,
set: "uwe",
f: e => {
f: e => { ///
fetch("https://icanhazdadjoke.com/slack")
.then(res => res.json())
.then(res => {
@ -353,9 +269,8 @@ export default bot => {
e.reply(res);
}).catch(err => console.log(err));
}
}));
bot._trigger.set("test", new bot.trigger({
}, { ///
name: "version",
call: /^\.version/i,
set: "uwe",
clients: ["irc"],
@ -374,17 +289,15 @@ export default bot => {
});
e.write(`privmsg ${e.args[0] || e.user.nick} :\u0001VERSION\u0001`);
}
}));
bot._trigger.set("mock", new bot.trigger({
}, {
name: "mock",
call: /^\.mock .*/i,
set: "uwe",
f: e => {
e.reply([...e.args.join(" ")].map(l => (l === " ") ? " " : (Math.round(Math.random()) === 0) ? l.toUpperCase() : l.toLowerCase()).join``);
}
}));
bot._trigger.set("sync", new bot.trigger({
}, { ///
name: "sync",
call: /^\.sync.*/i,
set: "uwe",
f: e => {
@ -398,62 +311,55 @@ export default bot => {
e.reply(`${data.name} @ https://sync.f0ck.space/r/${data.name} : ${data.user} Users, now playing: ${decodeURIComponent(data.title)}`);
}).catch(err => e.reply("Channel nicht gefunden D:"));
}
}));
bot._trigger.set("blech", new bot.trigger({
}, {
name: "blech",
call: /^(\.|\/)blech/i,
set: "uwe",
f: e => {
e.replyAction(`bereitet [b]${e.args[0] || e.user.nick}[/b] ein Blech Schore zu. Viel Vergnügen du Siffscheiße.`);
}
}));
bot._trigger.set("joghurt", new bot.trigger({
}, {
name: "joghurt",
call: /^(\.|\/)joghurt/i,
set: "uwe",
f: e => {
e.replyAction(`spritzt [b]${e.args[0] || e.user.nick}[/b] 500ml Joghurt in den Arsch.`);
}
}));
bot._trigger.set("kelly", new bot.trigger({
}, {
name: "kelly",
call: /^(\.|\/)kelly/i,
set: "uwe",
f: e => {
e.replyAction(`dreht [b]${e.args[0] || e.user.nick}[/b]'s dreckige Kelly Family Musik leiser und spuckt [b]${e.args[0] || e.user.nick}[/b] ins Gesicht.`);
}
}));
bot._trigger.set("pflaumen", new bot.trigger({
}, {
name: "pflaumen",
call: /^(\.|\/)pflaumen/i,
set: "uwe",
f: e => {
e.replyAction(`sieht, wie [b]${e.args[0] || e.user.nick}[/b] Pflaumen aus dem Arsch fallen.`);
}
}));
bot._trigger.set("quark", new bot.trigger({
}, {
name: "quark",
call: /^(\.|\/)quark/i,
set: "uwe",
f: e => {
e.replyAction(`schiebt [b]${e.args[0] || e.user.nick}[/b] 500g dickflüssigen Quark in den soften Arsch.`);
}
}));
bot._trigger.set("shrug", new bot.trigger({
}, {
name: "shrug",
call: /^so what$/i,
set: "uwe",
f: e => {
e.reply("¯\\_(ツ)_/¯");
}
}));
bot._trigger.set("wiedergeburt", new bot.trigger({
call: /^(\.|\/)wiedergeburtt$/i,
}, {
name: "wiedergeburt",
call: /^(\.|\/)wiedergeburt$/i,
set: "uwe",
f: e => {
e.reply("spielt Wiedergeburt aus, legt nxy vom Friedhof in die Monsterzone und beendet seinen Zug.");
}
}));
}];
};

View File

@ -2,8 +2,10 @@ import fetch from "flumm-fetch-cookies";
import { cfg } from "../../inc/cfg";
import { conds } from "./lib/wttr";
export default bot => {
bot._trigger.set("wttr", new bot.trigger({
export default async bot => {
return [{
name: "wttr",
call: /^\.wttr .*/i,
set: "uwe",
help: {
@ -62,9 +64,8 @@ export default bot => {
[body[0], body[2], body[3], body[4], body[5], body[6]].map(e.reply);
}).catch(err => console.log(err));
}
}));
bot._trigger.set("wttrnew", new bot.trigger({
}, {
name: "wttrnew",
call: /^(\.|\/)w .*/i,
set: "all",
help: {
@ -109,10 +110,9 @@ export default bot => {
e.reply(`Wetterbericht für: ${res.name}, ${res.sys.country}\n${[...Array(5)].map((_, i) => `${icon[i].padEnd(15)} ${data[i]}`).join("\n")}`);
}).catch(err => console.log(err));
}
}));
bot._trigger.set("weather", new bot.trigger({
}
}, {
name: "weather",
call: /^(\.|\/)weather .*/i,
set: "all",
help: {
@ -146,5 +146,5 @@ export default bot => {
}
}).catch(err => e.reply(err));
}
}));
}];
};