master
Kit Kasune 3 years ago
parent b74a2f8e55
commit 1cdbc6a65c
  1. 34
      .idea/workspace.xml
  2. 3
      bot.js
  3. 54
      commands/misc/sleeping.js
  4. 2
      commands/social/afk.js
  5. 24
      events/messageCreate.js
  6. 1
      models/user.js

@ -4,17 +4,7 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="826c705b-a7fa-4ece-b82a-e278fca7d494" name="Changes" comment="slash improvements">
<change afterPath="$PROJECT_DIR$/slash/fun/deathnote.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/package-lock.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/util/slash.d.ts" beforeDir="false" afterPath="$PROJECT_DIR$/util/slash.d.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/util/slash.js" beforeDir="false" afterPath="$PROJECT_DIR$/util/slash.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/util/slashmanager.js" beforeDir="false" afterPath="$PROJECT_DIR$/util/slashmanager.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/util/ts/slash.ts" beforeDir="false" afterPath="$PROJECT_DIR$/util/ts/slash.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/util/ts/slashmanager.ts" beforeDir="false" afterPath="$PROJECT_DIR$/util/ts/slashmanager.ts" afterDir="false" />
</list>
<list default="true" id="826c705b-a7fa-4ece-b82a-e278fca7d494" name="Changes" comment="/deathnote" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@ -108,7 +98,7 @@
<workItem from="1642537991410" duration="3454000" />
<workItem from="1642638383959" duration="700000" />
<workItem from="1642707112676" duration="1337000" />
<workItem from="1644446122031" duration="6700000" />
<workItem from="1644446122031" duration="7044000" />
</task>
<task id="LOCAL-00001" summary="not even gonna explain">
<created>1640148826800</created>
@ -187,7 +177,21 @@
<option name="project" value="LOCAL" />
<updated>1644449776897</updated>
</task>
<option name="localTasksCounter" value="12" />
<task id="LOCAL-00012" summary="more slash improvements">
<created>1644454927810</created>
<option name="number" value="00012" />
<option name="presentableId" value="LOCAL-00012" />
<option name="project" value="LOCAL" />
<updated>1644454927810</updated>
</task>
<task id="LOCAL-00013" summary="/deathnote">
<created>1644454968528</created>
<option name="number" value="00013" />
<option name="presentableId" value="LOCAL-00013" />
<option name="project" value="LOCAL" />
<updated>1644454968528</updated>
</task>
<option name="localTasksCounter" value="14" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@ -218,6 +222,8 @@
<MESSAGE value="SCM package scripts" />
<MESSAGE value="more generous daily windows" />
<MESSAGE value="slash improvements" />
<option name="LAST_COMMIT_MESSAGE" value="slash improvements" />
<MESSAGE value="more slash improvements" />
<MESSAGE value="/deathnote" />
<option name="LAST_COMMIT_MESSAGE" value="/deathnote" />
</component>
</project>

@ -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}),

@ -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 = [
"<a:NC_yawn:830701611990908961> Sleeping",
"<a:NC_yawn2:857589454830174219> Getting a good night's rest",
"<a:NC_yawn:830701611990908961> Big sleep",
"<a:NC_yawn2:857589454830174219> \\*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 <a:NC_NekoPet_1:861664617406136342><a:NC_NekoPet_2:861664756184252417>",
"<:NC_nezuGUN:852735951712157698> Get good sleep coward!"
]
)[Math.floor(Math.random() * 4)]
);
}
};

@ -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()}`);
}
};

@ -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)) {

@ -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},

Loading…
Cancel
Save