notification changes
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user