Skip to content

Commit

Permalink
Merge pull request #16 from Gisgar3/prerelease
Browse files Browse the repository at this point in the history
Add all commits from prerelease to master for v2.6.0 release
  • Loading branch information
Gisgar3 authored Jul 17, 2018
2 parents bab26bf + 26f9850 commit c37ddbd
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 11 deletions.
8 changes: 6 additions & 2 deletions commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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)"
]
}
97 changes: 90 additions & 7 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand All @@ -156,12 +156,25 @@ 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(`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)
if (`${stats[0].prerelease}` == "true" && `${stats[0].tag_name}`.endsWith("-RC")) {
embed.setFooter("BUILD STAGE: Release Candidate");
}
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);
}
else {
Expand All @@ -173,6 +186,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",
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ratzbot",
"version": "2.5.1",
"version": "2.6.0",
"description": "Discord bot for Twitch streamer ratzDoll",
"main": "main.js",
"scripts": {
Expand Down

0 comments on commit c37ddbd

Please sign in to comment.