diff --git a/bot/modules/releasenotes b/bot/modules/releasenotes.js similarity index 50% rename from bot/modules/releasenotes rename to bot/modules/releasenotes.js index fab3028..63d7eb6 100644 --- a/bot/modules/releasenotes +++ b/bot/modules/releasenotes.js @@ -1,4 +1,6 @@ var request = require('request'); +let hasPerms = require('../helpers.js').hasPerms; + exports.commands = [ "releasenotes" // command that is in this file, every command needs it own export as shown below @@ -8,7 +10,8 @@ exports.commands = [ exports.releasenotes = { usage: "", description: 'gets current release notes from GITHUB', - process: function(bot,msg){ + process: function(bot,msg,suffix){ + var headers = { 'Content-Type': 'application/json', 'User-Agent': 'Super Agent/0.0.1' @@ -26,24 +29,15 @@ exports.releasenotes = { releasename = JSON.parse(body).name releasedate = JSON.parse(body).published_at releaseurl = JSON.parse(body).html_url - msg.author.send({ - "embed": { - "title": "*Download " + releasename + " here!*", - "description": releasemessage, - "url": releaseurl, - "color": 7976557, - "timestamp": releasedate, - "author": { - "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 " - } - } - }) + message = {"embed": {"title": "*Download " + releasename + " here!*","description": releasemessage,"url": releaseurl,"color": 7976557,"timestamp": releasedate,"author": {"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 "}}} + if ( hasPerms(msg) === true && suffix === "post") { + var channelID = "370779899650375681" + bot.channels.get(channelID).send(message) + } else { + msg.channel.send(msg.author + " Release notes sent via DM") + msg.author.send(message) + } }) - + } }