mirror of
https://github.com/LBRYFoundation/lbry-wunderbot.git
synced 2025-08-31 17:31:32 +00:00
commit
b5d144111e
2 changed files with 9 additions and 41 deletions
|
@ -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));
|
||||
};
|
||||
|
|
|
@ -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)
|
||||
) {
|
||||
|
|
Loading…
Add table
Reference in a new issue