diff --git a/CHANGELOG.md b/CHANGELOG.md index e66e6b8..6b8996c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,12 @@ # Changelog +## Sep 22, 2017 +* Added `newThreadCategoryId` option. This option can be set to a category ID to place all new threads in that category. + ## Sep 20, 2017 * Fixed crash when the bot was unable to find or create a modmail thread * Reduced error log spam in case of network errors from Eris -* Fix unintended error when a message was ignored due to an "accidental thread" word +* Fixed unintended error when a message was ignored due to an "accidental thread" word ## Sep 19, 2017 * Added `logChannelId` option diff --git a/README.md b/README.md index 33616c2..90bae0f 100644 --- a/README.md +++ b/README.md @@ -59,3 +59,4 @@ These go in `config.json`. See also `config.example.json`. |snippetPrefix|"!!"|Prefix to use snippets. Defaults to `prefix` x2.| |inboxServerPermission|None|Permission required to use bot commands on the inbox server| |logChannelId|Server's default channel|Channel where to post links to closed threads and other alerts| +|newThreadCategoryId|None|ID of the category where new modmail thread channels should be placed| diff --git a/src/config.js b/src/config.js index 577b562..06b23a9 100644 --- a/src/config.js +++ b/src/config.js @@ -18,6 +18,8 @@ const defaultConfig = { "status": "Message me for help!", "responseMessage": "Thank you for your message! Our mod team will reply to you here as soon as possible.", + "newThreadCategoryId": null, + "inboxServerPermission": null, "alwaysReply": false, "alwaysReplyAnon": false, diff --git a/src/threads.js b/src/threads.js index c7cb465..d0d961c 100644 --- a/src/threads.js +++ b/src/threads.js @@ -1,4 +1,5 @@ const Eris = require('eris'); +const bot = require('./bot'); const transliterate = require('transliteration'); const jsonDb = require('./jsonDb'); const config = require('./config'); @@ -93,6 +94,11 @@ function getForUser(user, allowCreate = true, originalMessage = null) { username: `${user.username}#${user.discriminator}`, }; + if (config.newThreadCategoryId) { + // If a category id is specified, move the newly created channel there + bot.editChannel(channel.id, {parentID: config.newThreadCategoryId}); + } + return jsonDb.get('threads', []).then(threads => { threads.push(thread); jsonDb.save('threads', threads);