This commit is contained in:
Flummi 2017-11-26 15:38:46 +01:00
parent d7abf6a5b2
commit 4af52d6609

View File

@ -1,4 +1,4 @@
const https = require("https");
const rp = require("request-promise");
const feed = "https://www.kernel.org/releases.json";
@ -9,18 +9,10 @@ module.exports = bot => {
active: true,
clients: ["irc", "tg"],
f: e => {
https.get(feed, res => {
let content = "";
res.on('data', chunk => content += chunk.toString());
res.on('end', () => {
const releases = JSON.parse(content).releases;
const out = [];
for (let entry in releases)
out.push(`[b]${releases[entry].version}[/b] (${releases[entry].moniker}${releases[entry].iseol ? `, [i]EOL[/i]` : ""})`);
e.reply(out.join(", "));
});
rp(feed).then(content => {
const releases = JSON.parse(content).releases;
e.reply(releases.map(entry => `[b]${entry.version}[/b] (${entry.moniker}${entry.iseol ? `, [i]EOL[/i]` : ""})`).join(", "));
});
}
});
};