random stuff and bugs

master
Kit Kasune 4 years ago
parent 83468b668c
commit 902631d772
  1. 2
      events/message.js
  2. 47
      responses/wubzy.js
  3. 4
      util/lxp/cacheloop.js

@ -29,7 +29,7 @@ module.exports = async (client, message) => {
if ([`<@${client.user.id}>`, `<@!${client.user.id}>`].includes(msg)) { if ([`<@${client.user.id}>`, `<@!${client.user.id}>`].includes(msg)) {
return message.channel.send(new Discord.MessageEmbed() return message.channel.send(new Discord.MessageEmbed()
.setTitle(["Yep, that's me!", "^^ Hiya!", "Oh, hi there!", "Sure, what's up?", "How can I help!", "Natsuki is busy, but I can take a message for you!", "Teehee that's me!", "You were looking for Natsuki Tivastl, right?", "Sure! What's up?", "Pong!"][Math.floor(Math.random() * 10)]) .setTitle(["Yep, that's me!", "^^ Hiya!", "Oh, hi there!", "Sure, what's up?", "How can I help!", "Natsuki is busy, but I can take a message for you!", "Teehee that's me!", "You were looking for Natsuki Tivastl, right?", "Sure! What's up?", "Pong!"][Math.floor(Math.random() * 10)])
.setDescription("My prefix here is `" + prefix + "`. Use `" + prefix + "help` to see what commands you can use.") .setDescription(`My prefix here is \`${prefix}\`. Use \`${prefix}help\` to see what commands you can use.`)
.setColor('c375f0')); .setColor('c375f0'));
} }

@ -12,9 +12,9 @@ module.exports = {
.addField("Syntax", "``"), .addField("Syntax", "``"),
async condition (message, msg, args, cmd, prefix, mention, client) {return message.author.id === "330547934951112705"}, async condition (message, msg, args, cmd, prefix, mention, client) {return message.author.id === "330547934951112705"},
async execute(message, msg, args, cmd, prefix, mention, client) { async execute(message, msg, args, cmd, prefix, mention, client) {
const inc = m => msg.includes(m); const inc = (m,s) => s ? s.toLowerCase().includes(m) : msg.includes(m);
const is = m => msg.trim() === m; const is = m => msg.trim() === m;
function incl(ml) {let tm; for (tm of ml) {if (inc(tm)) {return true;}}} function incl(ml, s) {let tm; for (tm of ml) {if (inc(tm, s)) {return true;}}}
if (incl(["thanks natsuki", "thank you natsuki", "ty natsuki"])) { if (incl(["thanks natsuki", "thank you natsuki", "ty natsuki"])) {
const r = ["Anytime!", "Anything for my creator!", "I hope I was at least a little bit helpful!", const r = ["Anytime!", "Anything for my creator!", "I hope I was at least a little bit helpful!",
@ -37,7 +37,7 @@ module.exports = {
try {sconf = await message.channel.awaitMessages(m => m.author.id === "330547934951112705", {time: 15000, errors: ['time'], max: 1});} try {sconf = await message.channel.awaitMessages(m => m.author.id === "330547934951112705", {time: 15000, errors: ['time'], max: 1});}
catch {message.channel.send("Oh, I guess he already went to bed, huh? I'll just... set his status anyways-"); to = true;} catch {message.channel.send("Oh, I guess he already went to bed, huh? I'll just... set his status anyways-"); to = true;}
if (sconf) {sconf = sconf.first().content.trim().toLowerCase();} if (sconf) {sconf = sconf.first().content.trim().toLowerCase();}
if (to || ['sure', 'ye', 'mhm'].includes(sconf)) { if (to || incl(['ye', 'mhm', 'sure'], sconf)) {
let w = await UserData.findOne({uid: message.author.id}); let w = await UserData.findOne({uid: message.author.id});
w.statusclearmode = 'manual'; w.statusclearmode = 'manual';
w.statusmsg = "Sleeping <a:rollingcat:766362862976892958>"; w.statusmsg = "Sleeping <a:rollingcat:766362862976892958>";
@ -48,7 +48,48 @@ module.exports = {
w.save(); w.save();
if (!to) {message.channel.send("I set your status for you so you can get some sleep! Message me when you're up - I get lonely when you sleep ;-;");} if (!to) {message.channel.send("I set your status for you so you can get some sleep! Message me when you're up - I get lonely when you sleep ;-;");}
return; return;
} else {return message.channel.send("Oh... well, goodnight! Let me know when you're up, this castle gets so lonely when you're asleep");}
} }
if (inc('anime') && incl(['we binging', 'am i watching', 'should i watch', 'to watch', 'we watching', "am i gonna watch", "are we gonna watch"]) && inc("natsuki")) {
async function q() {
let sconf;
const r1 = ["Hmm, you could", "You could always", "How about you", "You can", "Tough question. Maybe", "Glad you asked! You should", "Oh I know the perfect one:"];
const r2 = ["rebinge Arifureta", "watch ~~tits the anime~~ DxD :wink:", "do Fairy Tail", "sob to Violet Evergarden again", "see Tokyo Ghoul for the millionth time", "watch ReZero", "finally start Attack on Titan Season 4",
"watch quintessential quintuplets", "have your heart wrenched out by Senko-San again", "finish Bleach", "finish Akame ga Kill", "start Guren Lagann", "finish Darling in the Franxx again",
"watch Akashic Records again", "finish Rent-a-Girlfriend", "rebinge Kabaneri and question reality", "rewatch Code Geass", "do a thing called getting the hell off anime and doing something productive with your life!"];
message.channel.send(`${r1[Math.floor(Math.random() * r1.length)]} ${r2[Math.floor(Math.random() * r2.length)]}`);
try {sconf = await message.channel.awaitMessages(m => m.author.id === "330547934951112705", {time: 15000, errors: ['time'], max: 1});}
catch {message.channel.send("Oh, I guess he liked the idea that much and just left..."); return 2;}
sconf = sconf.first().content.trim().toLowerCase();
if (incl(["bet", "i like", "yes", "sure", "fine", "alright", "ok"], sconf)) {
const r3 = ["Glad you liked the idea!", "Smart move!", "Hehe I'm good at reccomendations, aren't I?", "Yay I love it when Wubby likes my suggestions"];
message.channel.send(`${r3[Math.floor(Math.random() * r3.length)]} Want me to set your status?`);
return 1;
} else {
const r3 = ["Oh, my bad.", "Sorry bout that. Lemme try again", "Bad idea? Yeah I didn't think it was that good of an idea anyways.", "Uhhhh- pfff I was just joking anyways"];
message.channel.send(r3[Math.floor(Math.random() * r3.length)]);
return await q();
}
}
let res = await q();
if (res === 2) {return;}
let to = false; let sconf;
try {sconf = await message.channel.awaitMessages(m => m.author.id === "330547934951112705", {time: 15000, errors: ['time'], max: 1});}
catch {message.channel.send("Guess my recommendations are just that good that he left... Don't mind me while I set his status anyways"); to = true;}
if (sconf) {sconf = sconf.first().content.trim().toLowerCase();}
if (to || incl(['ye', 'mhm', 'sure'], sconf)) {
let w = await UserData.findOne({uid: message.author.id});
w.statusclearmode = 'manual';
w.statusmsg = "Watching anime (that I personally recommended him because I'm cool so leave poor Wubzy be!)";
w.statussetat = new Date();
let tempDate = new Date();
w.statusclearat = tempDate.setHours(tempDate.getHours() + 12);
w.statustype = 'dnd';
w.save();
if (!to) {message.channel.send("I set your status for you so you can get some binging in! Let me know if your anime is any good, I've been looking for a good watch myself.");}
return;
} else {return message.channel.send("Watching anime in incognito are we? I gotcha :p");}
} }
} }
}; };

@ -2,18 +2,18 @@ const LXP = require('../../models/localxp');
module.exports = async (client) => { module.exports = async (client) => {
let cd = new Date().getTime(); let cd = new Date().getTime();
await client.misc.cache.lxp.enabled.forEach(gxp => { await Object.keys(client.misc.cache.lxp.xp).forEach(gxp => {
LXP.findOne({gid: gxp}).then(xp => { LXP.findOne({gid: gxp}).then(xp => {
if (!xp) {return;} if (!xp) {return;}
Object.keys(client.misc.cache.lxp.xp[gxp]).forEach(user => { Object.keys(client.misc.cache.lxp.xp[gxp]).forEach(user => {
xp.xp[user] = [client.misc.cache.lxp.xp[gxp][user].xp, client.misc.cache.lxp.xp[gxp][user].level]; xp.xp[user] = [client.misc.cache.lxp.xp[gxp][user].xp, client.misc.cache.lxp.xp[gxp][user].level];
xp.markModified(`xp.${user}`); xp.markModified(`xp.${user}`);
xp.save();
if (cd - client.misc.cache.lxp.xp[gxp][user].lastXP > 600000) { if (cd - client.misc.cache.lxp.xp[gxp][user].lastXP > 600000) {
delete client.misc.cache.lxp.xp[gxp][user]; delete client.misc.cache.lxp.xp[gxp][user];
if (!Object.keys(client.misc.cache.lxp.xp[gxp]).length) {delete client.misc.cache.lxp.xp[gxp];} if (!Object.keys(client.misc.cache.lxp.xp[gxp]).length) {delete client.misc.cache.lxp.xp[gxp];}
} }
}); });
xp.save();
}) })
}) })
}; };
Loading…
Cancel
Save