notification changes

This commit is contained in:
indifferentketchup
2026-04-08 09:22:47 -05:00
parent 4d53ef179f
commit a4fb82620a
9 changed files with 740 additions and 131 deletions

View File

@@ -9,7 +9,7 @@
* per ticket (highest newly-crossed threshold only).
*/
const { mongoose } = require('../db-connection');
const { CONFIG } = require('../config');
const { CONFIG, parseThresholdString } = require('../config');
const { increment } = require('./patternStore');
const Ticket = mongoose.model('Ticket');
@@ -53,8 +53,12 @@ async function notifyStaffOfReply(guild, ticket, message) {
* threshold) into every staff notification channel.
*/
async function notifyAllStaffUnclaimed(client) {
const thresholds = CONFIG.UNCLAIMED_REMINDER_THRESHOLDS;
if (!thresholds || thresholds.length === 0) return;
const rawThresholds = (CONFIG.NOTIFICATION_THRESHOLDS && CONFIG.NOTIFICATION_THRESHOLDS.unclaimed_reminder) || [];
const thresholds = rawThresholds
.map(parseThresholdString)
.filter(n => Number.isFinite(n) && n >= 0)
.map(ms => ms / (60 * 60 * 1000));
if (thresholds.length === 0) return;
const sorted = [...thresholds].sort((a, b) => a - b);
const now = Date.now();