Skip to content

Commit

Permalink
Add event commands
Browse files Browse the repository at this point in the history
Added event commands for upcoming events.
  • Loading branch information
Gisgar3 committed Jul 20, 2018
1 parent 72533f0 commit 4803c58
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
8 changes: 6 additions & 2 deletions commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
"/ratz ratcoininfo + Twitch Username",
"/ratz laststream",
"/ratz gituserinfo + GitHub Username",
"/ratz gitrepoinfo + {GitHubUsername}/{RepositoryName}"
"/ratz gitrepoinfo + {GitHubUsername}/{RepositoryName}",
"/ratz showactiveevent",
"/ratz joinactiveevent"
],
"definitions": [
"Shows all commands for ratzBot",
Expand All @@ -27,6 +29,8 @@
"Shows the amount of RTC a user has on Twitch",
"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)"
"Show information for provided GitHub repository (which is owned by the provided GitHub username)",
"Shows active server event",
"Join active server event"
]
}
33 changes: 33 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ const package = require("./package.json");
const { app, BrowserWindow } = require('electron');
var date = new Date();

//-----SERVER EVENTS-----
var activeevent = "";
// ---------

// -----CHANNELS-----
var logChannel = "423939166401855518";
var newcomerChannel = "423937750937501697";
Expand Down Expand Up @@ -271,6 +275,29 @@ bot.on('message', (message) => {
}
})
}
// -----SERVER EVENTS-----
if (message.content.toString() == "/ratz joinactiveevent") {
if (activeevent == "") {
message.channel.send(`${message.author}, there is no active event on the server.`);
}
else {
try {
fs.appendFileSync("./exclude/eventuserlist.ratz", `\r\n${message.author.id}`);
message.channel.send(`${message.author}, you are now joined into the ${activeevent}!`);
}
catch (err) {
message.channel.send(`${message.author}, an error occured during the process. Try again later.`);
}
}
}
if (message.content.toString() == "/ratz showactiveevent") {
if (activeevent == "") {
message.channel.send(`${message.author}, there is no active event on the server.`);
}
else {
message.channel.send(`${message.author}, the active event on the server is the ${activeevent}.`);
}
}
// -----STREAMLABS INTEGRATION-----
if (message.content.startsWith("/ratz ratcoininfo ")) {
var result = message.content.slice(18);
Expand Down Expand Up @@ -449,6 +476,12 @@ rl.on("line", (input) => {
console.log(`**ERROR**: ${err}`);
}
}
// -----SERVER EVENTS-----
if (input.toString().startsWith("/ratz setevent ")) {
var result = input.slice(15);
activeevent = result;
console.log(`**EVENT**: Event has been set.`);
}
})


Expand Down

0 comments on commit 4803c58

Please sign in to comment.