Ignore the messy code. I've been working for hours on end and haven't had time to organize it.
I keep getting this error everytime the messageCount is 100 or more.
const profileData = await Profiles.findOne({
userID: message.author.id
});
if (!profileData) return console.log('re')
try {
if (profileData.messageCount >= 100) {
console.log('yeet')
await Profiles.updateMany({
userID: message.author.id
}, {
messageCount: 0,
}, {
$inc: {
caseCount: +1
}
}, {
upsert: true
});
} else {
console.log('na')
}
} catch (error) {
console.log(error);
}