From 92508c7e3fa2dea9ee4ebb76a519d606bc9710b7 Mon Sep 17 00:00:00 2001 From: HaydenMeloche Date: Tue, 6 Mar 2018 18:40:38 -0500 Subject: [PATCH] Added user configurable mentions --- src/config.js | 1 + src/data/threads.js | 5 ++++- src/main.js | 5 ++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/config.js b/src/config.js index 89abb30..c2c79f2 100644 --- a/src/config.js +++ b/src/config.js @@ -21,6 +21,7 @@ const defaultConfig = { "responseMessage": "Thank you for your message! Our mod team will reply to you here as soon as possible.", "newThreadCategoryId": null, + "mentionRoleID": null, "inboxServerPermission": null, "alwaysReply": false, diff --git a/src/data/threads.js b/src/data/threads.js index 58fd71c..25f551c 100644 --- a/src/data/threads.js +++ b/src/data/threads.js @@ -79,9 +79,12 @@ async function createNewThreadForUser(user) { const newThread = await findById(newThreadId); + //If no role is set, mention @here + const mention = (config.mentionRoleID == null) ? "@here" : `<@&${config.mentionRoleID}>`; + // Ping moderators of the new thread await newThread.postNonLogMessage({ - content: `@here New modmail thread (${newThread.user_name})`, + content: `${mention} New modmail thread (${newThread.user_name})`, disableEveryone: false }); diff --git a/src/main.js b/src/main.js index 5c665b5..3701247 100644 --- a/src/main.js +++ b/src/main.js @@ -140,8 +140,11 @@ bot.on('messageCreate', async msg => { // If the person who mentioned the bot is blocked, ignore them if (await blocked.isBlocked(msg.author.id)) return; + //If no role is set, mention @here + const mention = (config.mentionRoleID == null) ? "@here" : `<@&${config.mentionRoleID}>`; + bot.createMessage(utils.getLogChannel(bot).id, { - content: `@here Bot mentioned in ${msg.channel.mention} by **${msg.author.username}#${msg.author.discriminator}**: "${msg.cleanContent}"`, + content: `${mention} Bot mentioned in ${msg.channel.mention} by **${msg.author.username}#${msg.author.discriminator}**: "${msg.cleanContent}"`, disableEveryone: false, }); });