Merge #397
commit
e0aa3a73ae
|
@ -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.
|
||||
|
|
|
@ -254,6 +254,11 @@
|
|||
"default": "\uD83D\uDCE8"
|
||||
},
|
||||
|
||||
"threadOnMention": {
|
||||
"$ref": "#/definitions/customBoolean",
|
||||
"default": false
|
||||
},
|
||||
|
||||
"port": {
|
||||
"type": "number",
|
||||
"maximum": 65535,
|
||||
|
|
10
src/main.js
10
src/main.js
|
@ -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 });
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue