Dragory 2020-08-16 18:34:51 +03:00
commit e0aa3a73ae
No known key found for this signature in database
GPG Key ID: 5F387BA66DF8AAC1
3 changed files with 18 additions and 1 deletions

View File

@ -272,6 +272,10 @@ The bot's "Playing" text
**Default:** `on`
If enabled, channel permissions for the thread are synchronized with the category when using `!move`. Requires `allowMove` to be enabled.
#### threadOnMention
**Default:** `off`
If enabled, the bot will automatically create a new thread for a user who pings it.
#### threadTimestamps
**Default:** `off`
If enabled, modmail threads will show accurate UTC timestamps for each message, in addition to Discord's own timestamps.

View File

@ -254,6 +254,11 @@
"default": "\uD83D\uDCE8"
},
"threadOnMention": {
"$ref": "#/definitions/customBoolean",
"default": false
},
"port": {
"type": "number",
"maximum": 65535,

View File

@ -223,7 +223,6 @@ function initBaseMessageHandlers() {
content = `${staffMention}Bot mentioned in ${msg.channel.mention} (${msg.channel.guild.name}) by **${msg.author.username}#${msg.author.discriminator}(${msg.author.id})**: "${msg.cleanContent}"\n\n<https:\/\/discordapp.com\/channels\/${msg.channel.guild.id}\/${msg.channel.id}\/${msg.id}>`;
}
bot.createMessage(utils.getLogChannel().id, {
content,
disableEveryone: false,
@ -234,6 +233,15 @@ function initBaseMessageHandlers() {
const botMentionResponse = utils.readMultilineConfigValue(config.botMentionResponse);
bot.createMessage(msg.channel.id, botMentionResponse.replace(/{userMention}/g, `<@${msg.author.id}>`));
}
// If configured, automatically open a new thread with a user who has pinged it
if (config.threadOnMention) {
const existingThread = await threads.findOpenThreadByUserId(msg.author.id);
if (! existingThread) {
// Only open a thread if we don't already have one
await threads.createNewThreadForUser(msg.author, { quiet: true });
}
}
});
}