This commit is contained in:
indifferentketchup
2026-03-28 18:39:00 -05:00
parent fc81ff32ca
commit 8a4e306f28
9 changed files with 99 additions and 122 deletions

View File

@@ -2,20 +2,19 @@
* Guild-specific settings (e.g. email ticket routing).
*/
const { mongoose } = require('../db-connection');
const { CONFIG } = require('../config');
const GuildSettings = mongoose.model('GuildSettings');
/**
* Get email ticket routing for a guild. Returns 'thread' or 'category'.
* If not set, defaults from CONFIG: thread if EMAIL_THREAD_CHANNEL_ID is set, else category.
* If not set, defaults to 'category'.
* @param {string} guildId
* @returns {Promise<'thread'|'category'>}
*/
async function getEmailRouting(guildId) {
const doc = await GuildSettings.findOne({ guildId }).select('emailRouting').lean();
if (doc && doc.emailRouting) return doc.emailRouting;
return CONFIG.EMAIL_THREAD_CHANNEL_ID ? 'thread' : 'category';
return 'category';
}
/**