diff --git a/commands.json b/commands.json index 8fec073..1b9bd64 100644 --- a/commands.json +++ b/commands.json @@ -4,13 +4,15 @@ "/ratz steamuserinfo + Steam64ID", "/ratz slimedog", "/ratz discorduserinfo + UserID", - "/ratz botinfo" + "/ratz botinfo", + "/ratz releaseinfo" ], "definitions": [ "Shows all commands for ratzBot", "Shows user information for provided Steam64 ID", "Authorizes user to type in server chat after reading the rules", "Shows user information for provided numerical Discord ID (not discriminator)", - "Shows all information about ratzBot" + "Shows all information about ratzBot", + "Shows the latest release information of ratzBot" ] } \ No newline at end of file diff --git a/main.js b/main.js index 906681d..721a5b7 100644 --- a/main.js +++ b/main.js @@ -129,6 +129,39 @@ bot.on('message', (message) => { } }) } + if (message.content.toString() == "/ratz releaseinfo") { + var getReleaseInfo = { + method: "GET", + url: `https://api.github.com/repos/Gisgar3/ratzBot/releases/latest`, + headers: { + "User-Agent": "Gisgar3" + } + } + request(getReleaseInfo, (error, response, body) => { + try { + if (!error & response.statusCode == 200) { + var stats = JSON.parse(body); + var embed = new Discord.RichEmbed() + .setTitle("ratzBot GitHub Release Information") + .setThumbnail(bot.user.avatarURL) + .setColor(0xcb00ff) + .setURL(stats.html_url) + .addField(`Latest Release`, "" + stats.name) + .addField(`Release Branch`, "" + stats.target_commitish) + .addField(`Tag`, stats.tag_name) + .addField(`Pre-Release Status`, "" + stats.prerelease) + .addField(`Author`, stats.author.login) + message.channel.send(embed); + } + else { + message.channel.send(`${error} + ${response.statusCode}`); + } + } + catch (err) { + console.log(`ERROR: ${err}`); + } + }) + } // -----TOPIC DETECTION AND REVIEW----- if ((message.content.includes("XXXTentacion") || message.content.includes("xxxtentacion")) && (message.content.includes("death") || message.content.includes("died"))) { if (fs.readFileSync("./exclude/approvedmessages.ratz").includes(message.content.toString())) { diff --git a/package-lock.json b/package-lock.json index ab270c5..fda0bd8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "ratzbot", - "version": "2.2.1", + "version": "2.3.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 5824e39..88f811b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ratzbot", - "version": "2.2.6", + "version": "2.3.0", "description": "Discord bot for Twitch streamer ratzDoll", "main": "main.js", "scripts": {