From 3911d92edc4cc9eb752c64a177644227d37bd2bb Mon Sep 17 00:00:00 2001 From: Dragory Date: Sat, 21 Apr 2018 15:54:41 +0300 Subject: [PATCH] Display source guild in bot mention notifications Only when using multiple main guilds. --- src/main.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main.js b/src/main.js index 67cde89..92acf67 100644 --- a/src/main.js +++ b/src/main.js @@ -151,8 +151,17 @@ bot.on('messageCreate', async msg => { // If the person who mentioned the bot is blocked, ignore them if (await blocked.isBlocked(msg.author.id)) return; + let content; + const mainGuilds = utils.getMainGuilds(); + + if (mainGuilds.length === 1) { + content = `${utils.getInboxMention()}Bot mentioned in ${msg.channel.mention} by **${msg.author.username}#${msg.author.discriminator}**: "${msg.cleanContent}"`; + } else { + content = `${utils.getInboxMention()}Bot mentioned in ${msg.channel.mention} (${msg.channel.guild.name}) by **${msg.author.username}#${msg.author.discriminator}**: "${msg.cleanContent}"`; + } + bot.createMessage(utils.getLogChannel(bot).id, { - content: `${utils.getInboxMention()}Bot mentioned in ${msg.channel.mention} by **${msg.author.username}#${msg.author.discriminator}**: "${msg.cleanContent}"`, + content, disableEveryone: false, }); });