diff --git a/bot/helpers.js b/bot/helpers.js index afca8b9..3bd4650 100644 --- a/bot/helpers.js +++ b/bot/helpers.js @@ -8,72 +8,40 @@ let statsBotChannels = config.get("statsbot"); // Checks if user is allowed to use a command only for mods/team members exports.hasPerms = function(msg) { - if (msg.member.roles.some(r => permRanks.perms.includes(r.name))) { - return true; - } else { - return false; - } + return msg.member.roles.some(r => permRanks.perms.includes(r.name)); }; // Check if command was sent in dm exports.inPrivate = function(msg) { - if (msg.channel.type == "dm") { - return true; - } else { - return false; - } + return msg.channel.type == "dm"; }; // Checks if Message was sent from a channel in speechBot Channels list exports.hasSpeechBotChannels = function(msg) { - if (speechBotChannels.channels.includes(msg.channel.id)) { - return true; - } else { - return false; - } + return speechBotChannels.channels.includes(msg.channel.id); }; // Checks if Message was sent from a channel in priceBot Channels list exports.hasPriceBotChannels = function(msg) { - if (priceBotChannels.channels.includes(msg.channel.id)) { - return true; - } else { - return false; - } + return priceBotChannels.channels.includes(msg.channel.id); }; // Checks if Message was sent from a Excluded channel exports.hasExcludedSpamChannels = function(msg) { - if (ExcludedSpam.channels.includes(msg.channel.id)) { - return true; - } else { - return false; - } + return ExcludedSpam.channels.includes(msg.channel.id); }; // Checks if Message was sent from a Excluded user exports.hasExcludedSpamUsers = function(msg) { - if (ExcludedSpam.users.includes(msg.author.id)) { - return true; - } else { - return false; - } + return ExcludedSpam.users.includes(msg.author.id); }; // Checks if Message was sent from a channel in hashBot Channels list exports.hasHashBotChannels = function(msg) { - if (hashBotChannels.channels.includes(msg.channel.id)) { - return true; - } else { - return false; - } + return hashBotChannels.channels.includes(msg.channel.id); }; // Checks if Message was sent from a channel in statsBot Channels list exports.hasStatsBotChannels = function(msg) { - if (statsBotChannels.channels.includes(msg.channel.id)) { - return true; - } else { - return false; - } + retrun(statsBotChannels.channels.includes(msg.channel.id)); }; diff --git a/bot/modules/spam-detection.js b/bot/modules/spam-detection.js index 57f8ba2..27d9aef 100644 --- a/bot/modules/spam-detection.js +++ b/bot/modules/spam-detection.js @@ -31,8 +31,8 @@ exports.antiSpam = function(bot) { bot.on("message", msg => { if ( inPrivate(msg) || - hasPerms(msg) || msg.author.bot || + hasPerms(msg) || hasExcludedSpamChannels(msg) || hasExcludedSpamUsers(msg) ) {