Skip to content

Commit

Permalink
Add GitHub Webhook
Browse files Browse the repository at this point in the history
Added GitHub webhook to track repository events.
  • Loading branch information
Gisgar3 committed Jul 9, 2018
1 parent c6c1d4b commit c5c4fc6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
35 changes: 20 additions & 15 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,19 @@ bot.on('message', (message) => {
}
else {
if (fs.readFileSync("./exclude/users.ratz").includes(message.author.id.toString()) == false) {
if (message.content.toString() == "/ratz slimedog") {
fs.appendFileSync("./exclude/users.ratz", `\r\n${message.author.id.toString()}`);
message.delete();
message.channel.send(`${message.author}, you now have access to type in the server!`);
if (message.author.username == "GitHub" && message.author.bot == 1) {

}
else {
message.delete();
message.channel.send(`${message.author}, you have not completely read the rules in order to have access to chat. To get access, re-read the rules and type the secret response message specified.`)
if (message.content.toString() == "/ratz slimedog") {
fs.appendFileSync("./exclude/users.ratz", `\r\n${message.author.id.toString()}`);
message.delete();
message.channel.send(`${message.author}, you now have access to type in the server!`);
}
else {
message.delete();
message.channel.send(`${message.author}, you have not completely read the rules in order to have access to chat. To get access, re-read the rules and type the secret response message specified.`)
}
}
}
else {
Expand Down Expand Up @@ -142,15 +147,15 @@ bot.on('message', (message) => {
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)
.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 {
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.3.0",
"version": "2.3.1",
"description": "Discord bot for Twitch streamer ratzDoll",
"main": "main.js",
"scripts": {
Expand Down

0 comments on commit c5c4fc6

Please sign in to comment.