Merge pull request #93 from JonasPardon/master

Added an optional close message
master
Miikka 2018-07-10 10:51:06 +03:00 committed by GitHub
commit a003a7b4e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 0 deletions

View File

@ -66,6 +66,7 @@ These go in `config.json`. See also `config.example.json`.
|prefix|"!"|Prefix for bot commands|
|status|"Message me for help"|The bot's "Playing" text|
|responseMessage|"Thank you for your message! Our mod team will reply to you here as soon as possible."|The bot's response to DMs that start a new thread|
|closeMessage|None|The bot's message to the user when the thread is closed|
|alwaysReply|false|If set to true, all messages in modmail threads will be relayed back to the user, even ones without `!r`|
|alwaysReplyAnon|false|If `alwaysReply` is set to true, this option controls whether the auto-reply is anonymous|
|useNicknames|false|If set to true, mod replies will use their nickname (on the inbox server) instead of their username|

View File

@ -45,6 +45,7 @@ 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.",
"closeMessage": null,
"newThreadCategoryId": null,
"mentionRole": "here",

View File

@ -14,6 +14,7 @@ module.exports = bot => {
async function applyScheduledCloses() {
const threadsToBeClosed = await threads.getThreadsThatShouldBeClosed();
for (const thread of threadsToBeClosed) {
if(config.closeMessage) await thread.postToUser(config.closeMessage);
await thread.close();
const logUrl = await thread.getLogUrl();
@ -67,6 +68,7 @@ module.exports = bot => {
}
// Regular close
if(config.closeMessage) await thread.postToUser(config.closeMessage);
await thread.close();
const logUrl = await thread.getLogUrl();
@ -84,6 +86,7 @@ module.exports = bot => {
if (! thread) return;
console.log(`[INFO] Auto-closing thread with ${thread.user_name} because the channel was deleted`);
if(config.closeMessage) await thread.postToUser(config.closeMessage);
await thread.close(true);
const logUrl = await thread.getLogUrl();