This commit is contained in:
Flummi 2017-12-01 16:31:26 +01:00
parent 3c6d3b951e
commit 43386da0c7

View File

@ -227,10 +227,10 @@ module.exports = bot => {
} }
})); }));
bot._trigger.set("joke", new bot.trigger({ bot._trigger.set("witz", new bot.trigger({
call: /^(\.|\/)joke$/i, call: /^(\.|\/)witz$/i,
f: e => { f: e => {
rp("http://www.funny4you.at/webmasterprogramm/zufallswitz.php") rp("http://www.funny4you.at/webmasterprogramm/zufallswitz.php?id=312")
.then(res => { .then(res => {
res = res res = res
.split("<br />").join("") .split("<br />").join("")
@ -241,7 +241,7 @@ module.exports = bot => {
.split("&uuml;").join("ü") .split("&uuml;").join("ü")
.split("&Auml;").join("Ä") .split("&Auml;").join("Ä")
.split("&Ouml;").join("Ö") .split("&Ouml;").join("Ö")
.split("&Üuml;").join("Ü") .split("&Uuml;").join("Ü")
.split("&szlig;").join("ß") .split("&szlig;").join("ß")
.split("&quot;").join("\"") .split("&quot;").join("\"")
.replace(/\<span.*/i, ""); .replace(/\<span.*/i, "");
@ -259,4 +259,25 @@ module.exports = bot => {
}); });
} }
})); }));
bot._trigger.set("joke", new bot.trigger({
call: /^(\.|\/)joke$/i,
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);
});
}
}));
}; };