diff --git a/commands.json b/commands.json index defab96..52ed098 100644 --- a/commands.json +++ b/commands.json @@ -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", @@ -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" ] } \ No newline at end of file diff --git a/main.js b/main.js index 21e2869..4e6aa4a 100644 --- a/main.js +++ b/main.js @@ -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"; @@ -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); @@ -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.`); + } })