witz & joke -> uwe

This commit is contained in:
Flummi 2018-03-08 09:21:44 +01:00
parent 963b7dfcd7
commit 60106a1da9
2 changed files with 57 additions and 56 deletions

View File

@ -255,60 +255,4 @@ export default bot => {
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.`);
} }
})); }));
bot._trigger.set("witz", new bot.trigger({
call: /^(\.|\/)witz$/i,
set: "nxy",
f: e => {
rp("http://www.funny4you.at/webmasterprogramm/zufallswitz.php?id=312")
.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({
call: /^(\.|\/)joke$/i,
set: "nxy",
f: e => {
rp("https://icanhazdadjoke.com/slack", { json: true })
.then(res => {
res = res.attachments[0].text;
if(e.network !== "Telegram") {
res
.match(/.{1,450}/g)
.map(e.reply);
}
else
e.reply(res);
})
.catch(err => {
console.log(err);
});
}
}));
}; };

View File

@ -290,4 +290,61 @@ export default bot => {
e.replyAction(`schenkt [b]${e.args[0] || e.user.nick}[/b] eine [color=red]~~{~[@}[/color]`); e.replyAction(`schenkt [b]${e.args[0] || e.user.nick}[/b] eine [color=red]~~{~[@}[/color]`);
} }
})); }));
bot._trigger.set("witz", new bot.trigger({
call: /^(\.|\/)witz$/i,
set: "uwe",
f: e => {
rp("http://www.funny4you.at/webmasterprogramm/zufallswitz.php?id=312")
.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({
call: /^(\.|\/)joke$/i,
set: "uwe",
f: e => {
rp("https://icanhazdadjoke.com/slack", { json: true })
.then(res => {
res = res.attachments[0].text;
if(e.network !== "Telegram") {
res
.match(/.{1,450}/g)
.map(e.reply);
}
else
e.reply(res);
})
.catch(err => {
console.log(err);
});
}
}));
}; };