Merge pull request #91 from nikooo777/master

fixed crash in bot
This commit is contained in:
filipnyquist 2017-11-17 22:44:37 +01:00 committed by GitHub
commit b5d144111e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 41 deletions

View file

@ -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));
};

View file

@ -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)
) {