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