Skip to content

Commit

Permalink
Add '/ratz releaseinfo' command
Browse files Browse the repository at this point in the history
Added the '/ratz releaseinfo' command that gives the latest release information from the ratzBot GitHub repository.
  • Loading branch information
Gisgar3 committed Jul 9, 2018
1 parent 33eb32f commit 4383381
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 4 deletions.
6 changes: 4 additions & 2 deletions commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
33 changes: 33 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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())) {
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.2.6",
"version": "2.3.0",
"description": "Discord bot for Twitch streamer ratzDoll",
"main": "main.js",
"scripts": {
Expand Down

0 comments on commit 4383381

Please sign in to comment.