From 2819c2b4aeb499879ab98bb67f09ff6b9c3bf841 Mon Sep 17 00:00:00 2001 From: WubzyGD Date: Mon, 31 Jan 2022 16:52:59 -0700 Subject: [PATCH] more buggybois --- models/user.js | 3 ++- util/oncommand.js | 10 ++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/models/user.js b/models/user.js index 9b6f51c..e7ff88a 100644 --- a/models/user.js +++ b/models/user.js @@ -17,7 +17,8 @@ const UserSchema = new mongoose.Schema({ blacklisted: {type: Boolean, default: false}, donator: {type: Boolean, default: false}, bio: {type: String, default: ''}, - color: {type: String, default: ''} + color: {type: String, default: ''}, + msg: {type: Boolean} }); module.exports = mongoose.model("user", UserSchema); \ No newline at end of file diff --git a/util/oncommand.js b/util/oncommand.js index 955b724..d65e1a5 100644 --- a/util/oncommand.js +++ b/util/oncommand.js @@ -5,13 +5,11 @@ module.exports = async (message, msg, args, cmd, prefix, mention, client) => { let botData = await require('../models/bot').findOne({finder: 'lel'}); botData.commands = botData.commands + 1; botData.save(); - let tu = await UserData.findOne({uid: message.author.id}) - ? await UserData.findOne({uid: message.author.id}) - : new UserData({uid: message.author.id}); - tu.commands = tu.commands + 1; + let tu = await UserData.findOne({uid: message.author.id}) || new UserData({uid: message.author.id}); + tu.commands++; if (tu.commands > 50 && !tu.msg) { - message.author.send({embeds: [new Discord.MessageEmbed() + await message.author.send({embeds: [new Discord.MessageEmbed() .setThumbnail(client.user.avatarURL({size: 2048})) .setDescription(`Hey there **${message.author.username}**! Looks like you've used my commands over **50 times**${tu.commands > 51 ? ` (${tu.commands} to be exact)` : ''}!\nI hope you're enjoying the wonderful things I have to offer, because I've enjoyed offering them to you.`) .addField("What next?", "If you're enjoying what I do, you can [join my support server](https://discord.gg/u9c2uD24wB) to leave feedback and say hi to my developers. You can also consider [giving the repository a star](https://github.com/NatsukiDev/Natsuki) to show your support! I look forward to my time with you in the future <:hearty:812130944319750144>") @@ -22,5 +20,5 @@ module.exports = async (message, msg, args, cmd, prefix, mention, client) => { tu.msg = true; } - tu.save(); + await tu.save(); }; \ No newline at end of file