diff --git a/docs/configuration.md b/docs/configuration.md index fe06522..cbb107f 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -124,16 +124,19 @@ If set, the bot auto-replies to bot mentions (pings) with this message. Use `{us #### categoryAutomation.newThread **Default:** *None* -ID of the category where new threads are opened. Also functions as a fallback for `categoryAutomation.newThreadFromGuild`. +ID of the category where new threads are opened. Also functions as a fallback for `categoryAutomation.newThreadFromServer`. -#### categoryAutomation.newThreadFromGuild.GUILDID +#### categoryAutomation.newThreadFromGuild.SERVER_ID +Alias for [`categoryAutomation.newThreadFromServer`](#categoryAutomationNewThreadFromServerServer_id) + +#### categoryAutomation.newThreadFromServer.SERVER_ID **Default:** *None* -When running the bot on multiple main servers, this allows you to specify new thread categories for users from each guild. Example: +When running the bot on multiple main servers, this allows you to specify which category to use for modmail threads from each server. Example: ```ini # When the user is from the server ID 94882524378968064, their modmail thread will be placed in the category ID 360863035130249235 -categoryAutomation.newThreadFromGuild.94882524378968064 = 360863035130249235 +categoryAutomation.newThreadFromServer.94882524378968064 = 360863035130249235 # When the user is from the server ID 541484311354933258, their modmail thread will be placed in the category ID 542780020972716042 -categoryAutomation.newThreadFromGuild.541484311354933258 = 542780020972716042 +categoryAutomation.newThreadFromServer.541484311354933258 = 542780020972716042 ``` #### closeMessage diff --git a/src/cfg.js b/src/cfg.js index 69e12a6..abff870 100644 --- a/src/cfg.js +++ b/src/cfg.js @@ -121,6 +121,11 @@ if (! config.sqliteOptions) { }; } +// categoryAutomation.newThreadFromGuild => categoryAutomation.newThreadFromServer +if (config.categoryAutomation && config.categoryAutomation.newThreadFromGuild && ! config.categoryAutomation.newThreadFromServer) { + config.categoryAutomation.newThreadFromServer = config.categoryAutomation.newThreadFromGuild; +} + // Move greetingMessage/greetingAttachment to the guildGreetings object internally // Or, in other words, if greetingMessage and/or greetingAttachment is set, it is applied for all servers that don't // already have something set up in guildGreetings. This retains backwards compatibility while allowing you to override diff --git a/src/data/cfg.schema.json b/src/data/cfg.schema.json index ffb416d..6e0b676 100644 --- a/src/data/cfg.schema.json +++ b/src/data/cfg.schema.json @@ -227,7 +227,7 @@ "newThread": { "type": "string" }, - "newThreadFromGuild": { + "newThreadFromServer": { "type": "object", "patternProperties": { "^.+$": { @@ -235,6 +235,10 @@ "pattern": "^\\d+$" } } + }, + "newThreadFromGuild": { + "$comment": "Alias for categoryAutomation.newThreadFromServer", + "$ref": "#/properties/categoryAutomation/properties/newThreadFromServer" } }, "default": {} diff --git a/src/data/threads.js b/src/data/threads.js index 58692f0..2d986d0 100644 --- a/src/data/threads.js +++ b/src/data/threads.js @@ -142,9 +142,9 @@ async function createNewThreadForUser(user, opts = {}) { // Figure out which category we should place the thread channel in let newThreadCategoryId = hookResult.categoryId || null; - if (! newThreadCategoryId && config.categoryAutomation.newThreadFromGuild) { + if (! newThreadCategoryId && config.categoryAutomation.newThreadFromServer) { // Categories for specific source guilds (in case of multiple main guilds) - for (const [guildId, categoryId] of Object.entries(config.categoryAutomation.newThreadFromGuild)) { + for (const [guildId, categoryId] of Object.entries(config.categoryAutomation.newThreadFromServer)) { if (userGuildData.has(guildId)) { newThreadCategoryId = categoryId; break;