From 35f5b4d002da93d4bc56e939327a637f6d88cb41 Mon Sep 17 00:00:00 2001 From: Gavin Isgar Date: Mon, 16 Jul 2018 00:32:35 -0400 Subject: [PATCH 1/7] Add changelog information to '/ratz releaseinfo' command Added changelog information to the '/ratz releaseinfo' command. --- main.js | 1 + 1 file changed, 1 insertion(+) diff --git a/main.js b/main.js index 48c4630..a2b707f 100644 --- a/main.js +++ b/main.js @@ -160,6 +160,7 @@ bot.on('message', (message) => { .addField(`Latest Release`, "" + stats.name) .addField(`Release Branch`, "" + stats.target_commitish) .addField(`Tag`, stats.tag_name) + .addField(`Changelog`, stats.body) .addField(`Pre-Release Status`, "" + stats.prerelease) .addField(`Author`, stats.author.login) message.channel.send(embed); From 999c43794cd0a7def575e008b84efb18277716e6 Mon Sep 17 00:00:00 2001 From: Gavin Isgar Date: Mon, 16 Jul 2018 01:23:11 -0400 Subject: [PATCH 2/7] Add new '/ratz gituserinfo' and '/ratz gitrepoinfo' commands Added the '/ratz gituserinfo' and '/ratz gitrepoinfo' commands to retrieve information about GitHub users and GitHub repositories. --- commands.json | 8 ++++-- main.js | 70 +++++++++++++++++++++++++++++++++++++++++++++++ package-lock.json | 2 +- package.json | 2 +- 4 files changed, 78 insertions(+), 4 deletions(-) diff --git a/commands.json b/commands.json index 2a2d497..defab96 100644 --- a/commands.json +++ b/commands.json @@ -10,7 +10,9 @@ "/ratz stop", "/ratz btcinfo", "/ratz ratcoininfo + Twitch Username", - "/ratz laststream" + "/ratz laststream", + "/ratz gituserinfo + GitHub Username", + "/ratz gitrepoinfo + {GitHubUsername}/{RepositoryName}" ], "definitions": [ "Shows all commands for ratzBot", @@ -23,6 +25,8 @@ "Stops YouTube video audio", "Shows information about Bitcoin", "Shows the amount of RTC a user has on Twitch", - "Shows last stream VOD and VOD information" + "Shows last stream VOD and VOD information", + "Shows information for provided GitHub user", + "Show information for provided GitHub repository (which is owned by the provided GitHub username)" ] } \ No newline at end of file diff --git a/main.js b/main.js index a2b707f..6d2f220 100644 --- a/main.js +++ b/main.js @@ -174,6 +174,76 @@ bot.on('message', (message) => { } }) } + if (message.content.startsWith("/ratz gituserinfo ")) { + var result = message.content.slice(18); + var getGitUserInfo = { + method: "GET", + url: `https://api.github.com/users/${result}`, + headers: { + "User-Agent": "Gisgar3" + } + } + request(getGitUserInfo, (error, response, body) => { + try { + if (!error & response.statusCode == 200) { + var stats = JSON.parse(body); + const embed = new Discord.RichEmbed() + .setTitle(`GitHub User Information for ${result}`) + .setURL(stats.html_url) + .setColor(0xcb00ff) + .setThumbnail(stats.avatar_url) + .addField("Name", stats.name) + .addField("Company", "" + stats.company) + .addField("Bio", "" + stats.bio) + .addField("Location", "" + stats.location) + .addField("Email", "" + stats.email) + .addField("Hireable", "" + stats.hireable) + .addField("Public Repositories", stats.public_repos) + message.channel.send(embed); + } + else { + message.channel.send(`${message.author}, an error occured during the process. Try again later.`); + } + } + catch (err) { + message.channel.send(`${message.author}, an error occured during the process. Try again later.`); + } + }) + } + if (message.content.startsWith("/ratz gitrepoinfo ")) { + var result = message.content.slice(18); + var getGitRepoInfo = { + method: "GET", + url: `https://api.github.com/repos/${result}`, + headers: { + 'User-Agent': 'Gisgar3' + } + } + request(getGitRepoInfo, (error, response, body) => { + try { + if (!error & response.statusCode == 200) { + var stats = JSON.parse(body); + const embed = new Discord.RichEmbed() + .setTitle(`GitHub Repository for ${result}`) + .setURL(stats.html_url) + .setColor(0xcb00ff) + .setThumbnail(stats.owner.avatar_url) + .addField("Name", stats.name) + .addField("Description", stats.description) + .addField("Owner", stats.owner.login) + .addField("Language", stats.language) + .addField("Archive Status", stats.archived) + message.channel.send(embed); + } + else { + message.channel.send(`${message.author}, an error occured during the process. Try again later.`); + } + } + catch (err) { + message.channel.send(`${message.author}, an error occured during the process. Try again later.`); + } + }) + } if (message.content.toString() == "/ratz btcinfo") { var getBTCInfo = { method: "GET", diff --git a/package-lock.json b/package-lock.json index bc235f6..55c9dbe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "ratzbot", - "version": "2.5.1", + "version": "2.6.0 RC", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 40b5828..09dc89a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ratzbot", - "version": "2.5.1", + "version": "2.6.0 RC", "description": "Discord bot for Twitch streamer ratzDoll", "main": "main.js", "scripts": { From 4dcee6df597f614cdce4f575a155419d89c5bdc9 Mon Sep 17 00:00:00 2001 From: Gavin Isgar Date: Mon, 16 Jul 2018 01:24:34 -0400 Subject: [PATCH 3/7] Update version numbering Updated version numbering for v2.6.0-RC. --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 55c9dbe..61365fd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "ratzbot", - "version": "2.6.0 RC", + "version": "2.6.0-RC", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 09dc89a..4352985 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ratzbot", - "version": "2.6.0 RC", + "version": "2.6.0-RC", "description": "Discord bot for Twitch streamer ratzDoll", "main": "main.js", "scripts": { From 0b994eaffd2e78a934ec52b69b43be87de7e4e26 Mon Sep 17 00:00:00 2001 From: Gavin Isgar Date: Mon, 16 Jul 2018 01:32:52 -0400 Subject: [PATCH 4/7] Fix '/ratz releaseinfo' command to include pre-release builds Fixed the '/ratz releaseinfo' command to also include pre-release builds. --- main.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/main.js b/main.js index 6d2f220..5c8e56a 100644 --- a/main.js +++ b/main.js @@ -143,7 +143,7 @@ bot.on('message', (message) => { if (message.content.toString() == "/ratz releaseinfo") { var getReleaseInfo = { method: "GET", - url: `https://api.github.com/repos/Gisgar3/ratzBot/releases/latest`, + url: `https://api.github.com/repos/Gisgar3/ratzBot/releases`, headers: { "User-Agent": "Gisgar3" } @@ -156,13 +156,13 @@ bot.on('message', (message) => { .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(`Changelog`, stats.body) - .addField(`Pre-Release Status`, "" + stats.prerelease) - .addField(`Author`, stats.author.login) + .setURL(stats[0].html_url) + .addField(`Latest Release`, "" + stats[0].name) + .addField(`Release Branch`, "" + stats[0].target_commitish) + .addField(`Tag`, stats[0].tag_name) + .addField(`Changelog`, stats[0].body) + .addField(`Pre-Release Status`, "" + stats[0].prerelease) + .addField(`Author`, stats[0].author.login) message.channel.send(embed); } else { From f420db316349267630aedbfecd079f42d557715b Mon Sep 17 00:00:00 2001 From: Gavin Isgar Date: Mon, 16 Jul 2018 18:28:45 -0400 Subject: [PATCH 5/7] Add build stage footer to '/ratz releaseinfo' command Added the build stage of the latest release into the footer for the '/ratz releaseinfo' command. --- main.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.js b/main.js index 5c8e56a..965f5dc 100644 --- a/main.js +++ b/main.js @@ -163,6 +163,12 @@ bot.on('message', (message) => { .addField(`Changelog`, stats[0].body) .addField(`Pre-Release Status`, "" + stats[0].prerelease) .addField(`Author`, stats[0].author.login) + if (`${stats[0].prerelease}` == "true" && `${stats[0].tag_name}`.endsWith("-RC")) { + embed.setFooter("BUILD STAGE: Release Candidate"); + } + else { + embed.setFooter("BUILD STAGE: General Availability"); + } message.channel.send(embed); } else { From 013ab5a93c5eda25ad724041f01fa4ad54fe9d7d Mon Sep 17 00:00:00 2001 From: Gavin Isgar Date: Mon, 16 Jul 2018 20:06:12 -0400 Subject: [PATCH 6/7] Add more conditions to '/ratz releaseinfo' footer Added more possible conditions to '/ratz releaseinfo' footer text. --- main.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index 965f5dc..aaa190f 100644 --- a/main.js +++ b/main.js @@ -166,7 +166,13 @@ bot.on('message', (message) => { if (`${stats[0].prerelease}` == "true" && `${stats[0].tag_name}`.endsWith("-RC")) { embed.setFooter("BUILD STAGE: Release Candidate"); } - else { + else if (`${stats[0].prerelease}` == "true" && `${stats[0].tag_name}`.endsWith("-Beta")) { + embed.setFooter("BUILD STAGE: Beta"); + } + else if (`${stats[0].prerelease}` == "true" && `${stats[0].tag_name}`.endsWith("-Alpha")) { + embed.setFooter("BUILD STAGE: Alpha"); + } + else if (`${stats[0].prerelease}` == "false") { embed.setFooter("BUILD STAGE: General Availability"); } message.channel.send(embed); From 26f985060c48e56ed6e0e10e066da6d95cd6a4f1 Mon Sep 17 00:00:00 2001 From: Gavin Isgar Date: Tue, 17 Jul 2018 01:37:32 -0400 Subject: [PATCH 7/7] Change versioning for v2.6.0 release Changed versioning identification for v2.6.0 release. --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 61365fd..03f96a5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "ratzbot", - "version": "2.6.0-RC", + "version": "2.6.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 4352985..147d842 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ratzbot", - "version": "2.6.0-RC", + "version": "2.6.0", "description": "Discord bot for Twitch streamer ratzDoll", "main": "main.js", "scripts": {