From 270f4d32437579992de80f10eb65da93a469b755 Mon Sep 17 00:00:00 2001 From: MSFTserver Date: Thu, 26 Oct 2017 14:36:16 -0700 Subject: [PATCH 1/2] github release info bot --- bot/modules/releasenotes | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 bot/modules/releasenotes diff --git a/bot/modules/releasenotes b/bot/modules/releasenotes new file mode 100644 index 0000000..5f299c0 --- /dev/null +++ b/bot/modules/releasenotes @@ -0,0 +1,41 @@ +var request = require('request'); + +exports.commands = [ + "releasenotes" // command that is in this file, every command needs it own export as shown below +] + + +exports.releasenotes = { + usage: "", + description: 'gets current release notes from GITHUB', + process: function(bot,msg){ + var headers = { + 'Content-Type': 'application/json', + 'User-Agent': 'Super Agent/0.0.1' + } + // Configure the request + var options = { + url: 'https://api.github.com/repos/lbryio/lbry-app/releases/latest', + method: 'GET', + headers: headers, + } + + // Start the request + request(options, function (error, response, body) { + message = JSON.parse(body).body + msg.author.send({ + "embed": { + "title": "*Download the app here!*", + "description": message, + "url": "https://github.com/lbryio/lbry-app/releases", + "color": 7976557, + "author": { + "name": "Lbry-app Release Notes", + "icon_url": "https://i.imgur.com/yWf5USu.png" + } + } + }) + }) + + } +} From 83e7690fe1ed5e8c5f51df98298cffcc61721408 Mon Sep 17 00:00:00 2001 From: MSFTserver Date: Thu, 26 Oct 2017 15:00:47 -0700 Subject: [PATCH 2/2] Update releasenotes --- bot/modules/releasenotes | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/bot/modules/releasenotes b/bot/modules/releasenotes index 5f299c0..fab3028 100644 --- a/bot/modules/releasenotes +++ b/bot/modules/releasenotes @@ -22,16 +22,24 @@ exports.releasenotes = { // Start the request request(options, function (error, response, body) { - message = JSON.parse(body).body + releasemessage = JSON.parse(body).body + releasename = JSON.parse(body).name + releasedate = JSON.parse(body).published_at + releaseurl = JSON.parse(body).html_url msg.author.send({ "embed": { - "title": "*Download the app here!*", - "description": message, - "url": "https://github.com/lbryio/lbry-app/releases", + "title": "*Download " + releasename + " here!*", + "description": releasemessage, + "url": releaseurl, "color": 7976557, + "timestamp": releasedate, "author": { - "name": "Lbry-app Release Notes", - "icon_url": "https://i.imgur.com/yWf5USu.png" + "name": "Lbry-app Release Notes for " + releasename, + "icon_url": "http://www.pngall.com/wp-content/uploads/2016/04/Github-PNG-Image.png" + }, + "footer": { + "icon_url": "https://i.imgur.com/yWf5USu.png", + "text": "Lbry-app Updated " } } })