EZD Logik
This commit is contained in:
+13
-8
@@ -50,8 +50,19 @@ module.exports = {
|
||||
|
||||
if (!dbEntry) continue;
|
||||
|
||||
// skip if already notified
|
||||
if (dbEntry.notified) {
|
||||
// Reset notification once the birthday has passed
|
||||
if (!isToday(dbEntry.day, dbEntry.month) && dbEntry.notified) {
|
||||
await bdayColl.updateOne(
|
||||
{ userID: member.id },
|
||||
{ $set: { notified: false } }
|
||||
);
|
||||
|
||||
dbEntry.notified = false; // keep local copy in sync
|
||||
console.log(`Removed notified flag for ${member.user.tag}`);
|
||||
}
|
||||
|
||||
// Skip if already handled today
|
||||
if (dbEntry.notified && isToday(dbEntry.day, dbEntry.month)) {
|
||||
console.log(`${member.user.username} was already notified today, skipping...`);
|
||||
continue;
|
||||
}
|
||||
@@ -78,12 +89,6 @@ module.exports = {
|
||||
|
||||
console.log(`Removed birthday role from ${member.user.tag}`);
|
||||
}
|
||||
|
||||
// reset notification flag if not birthday anymore
|
||||
await bdayColl.updateOne(
|
||||
{ userID: member.id },
|
||||
{ $set: { notified: false } }
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user