diff --git a/src/InternalBot/Command.js b/src/InternalBot/Command.js index fa3830f..a96e8e9 100644 --- a/src/InternalBot/Command.js +++ b/src/InternalBot/Command.js @@ -284,4 +284,18 @@ Command.addCommand( ); */ +Command.addCommand( + new Command( + "time", + ["time"], + undefined, + `%Ptime`, + 0, + (cl, ch, msg) => { + return `It is ${cl.server.cycle.getCurrentGenericTime()}.`; + }, + "admin" + ) +); + module.exports = { Command }; diff --git a/src/MOTDGenerator.js b/src/MOTDGenerator.js index fa2137f..42953c1 100644 --- a/src/MOTDGenerator.js +++ b/src/MOTDGenerator.js @@ -17,8 +17,8 @@ let dayOfTheWeekMOTD = [ "Lapis doesn't own this!", "https://youtube.com/hri7566", "The most Brandon-like MPP", - "\"penis\" - Lapis", - "\"I have an OnlyFans\" - Nitsua", + '"penis" - Lapis', + '"I have an OnlyFans" - Nitsua', "Sola's favorite site", "This site has the most admin features out of any MPP.", "This site is older than MPPClone.", @@ -42,7 +42,17 @@ let dayOfTheWeekMOTD = [ "distant cat sounds", "NOBODY EXPECTS THE SPANISH INQUISITION!", "Who will Billy Mitchell sue next?", - "ayy lmao" + "ayy lmao", + "Khorne Bot", + "The greatest fantasy epic of our time.", + "Look out for a deranged hillbilly.", + "motd", + "Have you done today's wordle?", + "Give me the Nintendo.", + "Nutrition Facts", + "Staying safe online is an ever growing difficulty and you could be exploited by hackers. NordVPN allows you to change your IP address, making you harder to track, securing your privacy. Check out the link in the description to get 20% off for the first two months and thank you to NordVPN for sponsering this video.", + "MPPClone's profanity filter is a text file.", + "" ]; class MOTDGenerator { diff --git a/src/Server.js b/src/Server.js index 8b978a4..f4bf2b7 100644 --- a/src/Server.js +++ b/src/Server.js @@ -78,6 +78,7 @@ class Server { this.connections = new Map(); this.roomlisteners = new Map(); this.channels = new Map(); + this.cycle = require("./cycle"); this.specialIntervals = {}; diff --git a/src/cycle.js b/src/cycle.js new file mode 100644 index 0000000..5c80157 --- /dev/null +++ b/src/cycle.js @@ -0,0 +1,37 @@ +const Database = require("./Database"); + +module.exports = class Cycle { + static startOfDay = 0; + static time = this.startOfDay; + static endOfDay = 24; + + static cycleInterval = setInterval(() => { + try { + this.time = Database.utilGet("time"); + } catch (err) { + this.time = 0; + } + + this.time++; + + if (this.time > this.endOfDay) { + this.time = this.startOfDay; + } + + Database.utilSet("time", this.time); + }, 60 * 1000); + + static getCurrentTime() { + return this.time; + } + + static getCurrentGenericTime() { + if (this.time < 2) return "late night"; + if (this.time < 6) return "dawn"; + if (this.time < 12) return "morning"; + if (this.time < 14) return "day"; + if (this.time < 18) return "evening"; + if (this.time < 20) return "dusk"; + return "night"; + } +};