Fix most current issues (overlay issues, some issues with search functionality, and clear warnings functionality)

This commit is contained in:
2026-02-03 11:05:06 +01:00
parent 0bcf0829c8
commit c6204e1941
5 changed files with 322 additions and 15 deletions
+14
View File
@@ -40,7 +40,21 @@ const getWarnings = async ({ guildId, userId }) => {
return record?.warnings ?? [];
};
const clearWarnings = async ({ guildId, userId }) => {
const collection = await getWarningsCollection();
const result = await collection.findOneAndUpdate(
{ guildId, userId },
{ $set: { warnings: [] } },
{ returnDocument: 'after', upsert: true },
);
await updateStrikes({ guildId, userId, strikes: 0 });
return result.value?.warnings ?? [];
};
module.exports = {
addWarning,
getWarnings,
clearWarnings,
};