This commit is contained in:
karl.hudgell 2020-06-24 08:03:53 +01:00
parent 49056b195c
commit fd9446db1b

29
app.js
View File

@ -101,6 +101,35 @@ bot.on('message', (msg) => {
}) })
} }
const joke = name.toLowerCase() + " tell me a joke";
if (msg.text && msg.text.toString().toLowerCase().includes(joke)) {
logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " asked for a joke");
var options = {
method: 'GET',
url: 'https://joke3.p.rapidapi.com/v1/joke',
qs: { tz: 'Europe/London', leagues: '8', include: 'localTeam,visitorTeam' },
headers: {
'x-rapidapi-host': 'joke3.p.rapidapi.com',
'x-rapidapi-key': process.env.RAPIDAPI_API_KEY,
useQueryString: true
},
ttl: 18000 //5 hours
};
cachedRequest(options, function (error, response, body) {
if (error) throw new Error(error);
let jsonBody = JSON.parse(body)
bot.sendMessage(msg.chat.id, jsonBody.content)
}
)
}
const youThere = "you there " + name.toLowerCase() + "?";
if (msg.text && msg.text.toString().toLowerCase().includes(youThere)) {
logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " asked if im there");
bot.sendMessage(msg.chat.id, "Always...");
}
const fuuk = "fuck off "; const fuuk = "fuck off ";
const fuuckPlus = fuuk + name.toLowerCase() const fuuckPlus = fuuk + name.toLowerCase()