Add option: showResponseMessageInThreadChannel
parent
17c485306e
commit
623ec15d13
|
@ -331,7 +331,8 @@ Required amount of time (in minutes) the user must be a member of the server bef
|
|||
|
||||
#### responseMessage
|
||||
**Default:** `Thank you for your message! Our mod team will reply to you here as soon as possible.`
|
||||
The bot's response to the user when they message the bot and open a new modmail thread
|
||||
The bot's response to the user when they message the bot and open a new modmail thread.
|
||||
If you have a multi-line or otherwise long `responseMessage`, you might want to turn off [showResponseMessageInThreadChannel](#showResponseMessageInThreadChannel) to reduce clutter in the thread channel on the inbox server.
|
||||
|
||||
#### rolesInThreadHeader
|
||||
**Default:** `off`
|
||||
|
@ -348,6 +349,11 @@ serverGreetings.541484311354933258.message[] = Welcome to server ID 541484311354
|
|||
serverGreetings.541484311354933258.message[] = Second line of the greeting.
|
||||
```
|
||||
|
||||
#### showResponseMessageInThreadChannel
|
||||
**Default:** `on`
|
||||
Whether to show the [responseMessage](#responseMessage) sent to the user in the thread channel on the inbox server as well.
|
||||
If you have a multi-line or otherwise long `responseMessage`, it might be a good idea to turn this off to reduce clutter.
|
||||
|
||||
#### smallAttachmentLimit
|
||||
**Default:** `2097152`
|
||||
Size limit of `relaySmallAttachmentsAsAttachments` in bytes (default is 2MB)
|
||||
|
|
|
@ -481,6 +481,7 @@ class Thread {
|
|||
* @param {boolean} [allowedMentions.everyone]
|
||||
* @param {boolean|string[]} [allowedMentions.roles]
|
||||
* @param {boolean|string[]} [allowedMentions.users]
|
||||
* @param {boolean} [allowedMentions.postToThreadChannel]
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async sendSystemMessageToUser(text, opts = {}) {
|
||||
|
@ -495,12 +496,14 @@ class Thread {
|
|||
const dmContent = await formatters.formatSystemToUserDM(threadMessage);
|
||||
const dmMsg = await this._sendDMToUser(dmContent);
|
||||
|
||||
if (opts.postToThreadChannel !== false) {
|
||||
const inboxContent = await formatters.formatSystemToUserThreadMessage(threadMessage);
|
||||
const finalInboxContent = typeof inboxContent === "string" ? {content: inboxContent} : inboxContent;
|
||||
finalInboxContent.allowedMentions = opts.allowedMentions;
|
||||
const inboxMsg = await this._postToThreadChannel(inboxContent);
|
||||
|
||||
threadMessage.inbox_message_id = inboxMsg.id;
|
||||
}
|
||||
|
||||
threadMessage.dm_channel_id = dmMsg.channel.id;
|
||||
threadMessage.dm_message_id = dmMsg.id;
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
* @property {boolean} [autoAlert=false]
|
||||
* @property {string} [autoAlertDelay="2m"] Delay before auto-alert kicks in. Uses the same format as timed close; for example 1m30s for 1 minute and 30 seconds.
|
||||
* @property {boolean} [pinThreadHeader=false]
|
||||
* @property {boolean} [showResponseMessageInThreadChannel=true]
|
||||
* @property {string} [logStorage="local"]
|
||||
* @property {object} [logOptions]
|
||||
* @property {string} logOptions.attachmentDirectory
|
||||
|
|
|
@ -373,6 +373,11 @@
|
|||
"default": false
|
||||
},
|
||||
|
||||
"showResponseMessageInThreadChannel": {
|
||||
"$ref": "#/definitions/customBoolean",
|
||||
"default": true
|
||||
},
|
||||
|
||||
"logStorage": {
|
||||
"type": "string",
|
||||
"default": "local"
|
||||
|
|
|
@ -221,7 +221,6 @@ async function createNewThreadForUser(user, opts = {}) {
|
|||
});
|
||||
|
||||
const newThread = await findById(newThreadId);
|
||||
let responseMessageError = null;
|
||||
|
||||
if (! quiet) {
|
||||
// Ping moderators of the new thread
|
||||
|
|
|
@ -169,7 +169,8 @@ function initBaseMessageHandlers() {
|
|||
const responseMessage = utils.readMultilineConfigValue(config.responseMessage);
|
||||
|
||||
try {
|
||||
await thread.sendSystemMessageToUser(responseMessage);
|
||||
const postToThreadChannel = config.showResponseMessageInThreadChannel;
|
||||
await thread.sendSystemMessageToUser(responseMessage, { postToThreadChannel });
|
||||
} catch (err) {
|
||||
await thread.postSystemMessage(`**NOTE:** Could not send auto-response to the user. The error given was: \`${err.message}\``);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue