From 2f04ed835923627458eccc675b3336243d479276 Mon Sep 17 00:00:00 2001 From: Dragory Date: Thu, 20 Sep 2018 21:57:54 +0300 Subject: [PATCH] Fix pingOnBotMention on same server setups. Fixes #134 --- src/main.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main.js b/src/main.js index 01c4517..94e4a12 100644 --- a/src/main.js +++ b/src/main.js @@ -148,8 +148,14 @@ bot.on('messageCreate', async msg => { if (! msg.mentions.some(user => user.id === bot.user.id)) return; if (msg.author.bot) return; - // If the person who mentioned the modmail bot is also on the modmail server, ignore them - if (utils.getInboxGuild().members.get(msg.author.id)) return; + if (utils.messageIsOnInboxServer(msg)) { + // For same server setups, check if the person who pinged modmail is staff. If so, ignore the ping. + if (utils.isStaff(msg.member)) return; + } else { + // For separate server setups, check if the member is staff on the modmail server + const inboxMember = utils.getInboxGuild().members.get(msg.author.id); + if (inboxMember && utils.isStaff(inboxMember)) return; + } // If the person who mentioned the bot is blocked, ignore them if (await blocked.isBlocked(msg.author.id)) return;