forked from Hri7566/mpp-server-dev2
cycle
This commit is contained in:
parent
0eae040cbb
commit
216886e3f4
|
@ -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 };
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -78,6 +78,7 @@ class Server {
|
|||
this.connections = new Map();
|
||||
this.roomlisteners = new Map();
|
||||
this.channels = new Map();
|
||||
this.cycle = require("./cycle");
|
||||
|
||||
this.specialIntervals = {};
|
||||
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue