diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index e6c3220..c67b91d 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,17 +4,7 @@
-
-
-
-
-
-
-
-
-
-
-
+
@@ -108,7 +98,7 @@
-
+ 1640148826800
@@ -187,7 +177,21 @@
1644449776897
-
+
+ 1644454927810
+
+
+
+ 1644454927810
+
+
+ 1644454968528
+
+
+
+ 1644454968528
+
+
@@ -218,6 +222,8 @@
-
+
+
+
\ No newline at end of file
diff --git a/bot.js b/bot.js
index 320bded..0fd1dce 100644
--- a/bot.js
+++ b/bot.js
@@ -56,7 +56,8 @@ client.misc = {
monners: {},
monnersNames: new Map(),
spin: new spinnies(),
- rp: new Map()
+ rp: new Map(),
+ returnToSleep: new Map()
},
loggers: {},
rl: readline.createInterface({input: process.stdin, output: process.stdout}),
diff --git a/commands/misc/sleeping.js b/commands/misc/sleeping.js
new file mode 100644
index 0000000..8d01607
--- /dev/null
+++ b/commands/misc/sleeping.js
@@ -0,0 +1,54 @@
+const Discord = require('discord.js');
+
+const UserData = require("../../models/user");
+
+module.exports = {
+ name: "sleeping",
+ aliases: ['asleep', 'sloopin', 'ischleep'],
+ meta: {
+ category: 'Misc',
+ description: "Set your status to tell others you're sleeping.",
+ syntax: '`sleeping`',
+ extra: null
+ },
+ help: new Discord.MessageEmbed()
+ .setTitle("Help -> Sleeping")
+ .setDescription("Use this command to set an automatically-clearing AFK status that lets people who ping you know you're asleep. Send any message to any server with Natsuki in it to clear the status.")
+ .addField("Syntax", "`sleeping`"),
+ async execute(message, msg, args, cmd, prefix, mention, client) {
+ let tu = await UserData.findOne({uid: message.author.id}) || new UserData({uid: message.author.id});
+ tu.statusclearmode = 'auto';
+ tu.statustype = 'afk';
+ tu.statusmsg = [
+ " Sleeping",
+ " Getting a good night's rest",
+ " Big sleep",
+ " \\*snore\\*"
+ ][Math.floor(Math.random() * 4)];
+ tu.statussetat = new Date();
+ let tempDate = new Date();
+ tu.statusclearat = tempDate.setHours(tempDate.getHours() + 12);
+ tu.statusSleeping = true;
+ tu.markModified("statusSleeping");
+ tu.markModified("statussetat");
+ tu.markModified("statusclearat");
+ tu.save();
+ require('../../util/cachestatus')(message.author.id, tempDate.setHours(tempDate.getHours() + 10));
+ return message.channel.send(
+ (client.misc.cache.returnToSleep.has(message.author.id) && new Date().getTime() - client.misc.cache.returnToSleep.get(message.author.id) < 600000
+ ? [
+ "Ah, well I'm glad you're getting back to sleep! Try to put the phone down and get some rest qt",
+ "Actually taking my advice and getting some sleep? You need it after all!",
+ ":D You're going back to bed! I don't wanna see you up again. You need some sleep qt ^^",
+ "Sleep is good for you! It's best uninterrupted. Get some good sleep and try not to pick up your phone again."
+ ]
+ : [
+ "Goodnight qt <:NC_wave:830704926576345119>",
+ "<:NC_hearty:841489530413383712> Have a good sleep! ^^",
+ "Sleep well. You deserve it <3 ",
+ "<:NC_nezuGUN:852735951712157698> Get good sleep coward!"
+ ]
+ )[Math.floor(Math.random() * 4)]
+ );
+ }
+};
\ No newline at end of file
diff --git a/commands/social/afk.js b/commands/social/afk.js
index 5e79512..a482e50 100644
--- a/commands/social/afk.js
+++ b/commands/social/afk.js
@@ -45,6 +45,6 @@ module.exports = {
tu.markModified("statusclearat");
tu.save();
require('../../util/cachestatus')(message.author.id, tempDate.setHours(tempDate.getHours() + 12));
- return message.reply(`I set your ${tu.statusclearmode === 'auto' ? 'automatically' : 'manually'}-clearing AFK message to: ${reason.trim()}`);
+ return message.channel.send(`I set your ${tu.statusclearmode === 'auto' ? 'automatically' : 'manually'}-clearing AFK message to: ${reason.trim()}`);
}
};
\ No newline at end of file
diff --git a/events/messageCreate.js b/events/messageCreate.js
index 2f0c19f..80ff409 100644
--- a/events/messageCreate.js
+++ b/events/messageCreate.js
@@ -52,9 +52,29 @@ module.exports = async (client, message) => {
if (tu && tu.statusmsg.length && tu.statusclearmode === 'auto') {
tu.statusmsg = '';
tu.statustype = '';
- tu.save();
require('../util/siftstatuses')(client, message.author.id, true);
- message.reply('Hey there! You asked me to clear your status when you send a message next, so I went ahead and did that for you.').then(m => {setTimeout(() => {m.delete().catch(() => {});}, 5000);}).catch(() => {});
+ message.reply(
+ tu.statusSleeping
+ ? tu.statussetat && (new Date().getTime() - tu.statussetat < 60 * 45 * 1000)
+ ? [
+ "Did you even sleep?! Well I cleared your status, but c'mon now!",
+ ">:( That was hardly even sleep.",
+ "You should really go back to bed.",
+ "Burning the midnight oil are we? Go back to bed!"
+ ][Math.floor(Math.random() *4)]
+ : [
+ "Good morning dear!",
+ "Heyo! Rise and shine!",
+ "Welcome! Hope you slept well.",
+ "Good morning awesome wonderful person. Ready to start the day?"
+ ][Math.floor(Math.random() *4)]
+ : 'Hey there! You asked me to clear your status when you send a message next, so I went ahead and did that for you.'
+ ).then(m => {setTimeout(() => {m.delete().catch(() => {});}, 5000);}).catch(() => {});
+ if (tu.statusSleeping) {
+ tu.statusSleeping = false; tu.markModified('statusSleeping');
+ if (tu.statussetat && (new Date().getTime() - tu.statussetat < 60 * 45 * 1000)) {client.misc.cache.returnToSleep.set(message.author.id, new Date().getTime());}
+ }
+ tu.save();
}});
if (message.guild && client.misc.cache.rp.has(message.guild.id) && client.misc.cache.rp.get(message.guild.id).includes(message.channel.id)) {
diff --git a/models/user.js b/models/user.js
index e7ff88a..3c21695 100644
--- a/models/user.js
+++ b/models/user.js
@@ -9,6 +9,7 @@ const UserSchema = new mongoose.Schema({
statusclearat: {type: Date, default: null},
statussetat: {type: Date, default: null},
statusshowcleartime: {type: Boolean, default: true},
+ statusSleeping: Boolean,
statusshowsettime: {type: Boolean, default: true},
support: {type: Boolean, default: false},
staff: {type: Boolean, default: false},