Add newThreadCategoryId option

master
Miikka Virtanen 2017-09-22 22:18:15 +03:00
parent ccb6f7345b
commit b2d9c93f43
4 changed files with 13 additions and 1 deletions

View File

@ -1,9 +1,12 @@
# Changelog # 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 ## Sep 20, 2017
* Fixed crash when the bot was unable to find or create a modmail thread * 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 * 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 ## Sep 19, 2017
* Added `logChannelId` option * Added `logChannelId` option

View File

@ -59,3 +59,4 @@ These go in `config.json`. See also `config.example.json`.
|snippetPrefix|"!!"|Prefix to use snippets. Defaults to `prefix` x2.| |snippetPrefix|"!!"|Prefix to use snippets. Defaults to `prefix` x2.|
|inboxServerPermission|None|Permission required to use bot commands on the inbox server| |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| |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|

View File

@ -18,6 +18,8 @@ const defaultConfig = {
"status": "Message me for help!", "status": "Message me for help!",
"responseMessage": "Thank you for your message! Our mod team will reply to you here as soon as possible.", "responseMessage": "Thank you for your message! Our mod team will reply to you here as soon as possible.",
"newThreadCategoryId": null,
"inboxServerPermission": null, "inboxServerPermission": null,
"alwaysReply": false, "alwaysReply": false,
"alwaysReplyAnon": false, "alwaysReplyAnon": false,

View File

@ -1,4 +1,5 @@
const Eris = require('eris'); const Eris = require('eris');
const bot = require('./bot');
const transliterate = require('transliteration'); const transliterate = require('transliteration');
const jsonDb = require('./jsonDb'); const jsonDb = require('./jsonDb');
const config = require('./config'); const config = require('./config');
@ -93,6 +94,11 @@ function getForUser(user, allowCreate = true, originalMessage = null) {
username: `${user.username}#${user.discriminator}`, 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 => { return jsonDb.get('threads', []).then(threads => {
threads.push(thread); threads.push(thread);
jsonDb.save('threads', threads); jsonDb.save('threads', threads);