mirror of
https://github.com/LBRYFoundation/lbry-wunderbot.git
synced 2025-08-23 17:47:27 +00:00
Moved Spam Detection Variables to Config
This commit is contained in:
parent
9baf2926f0
commit
b9dc5c6dfa
1 changed files with 8 additions and 7 deletions
|
@ -8,6 +8,7 @@ let hasPerms = require('../helpers.js').hasPerms;
|
||||||
let inPrivate = require('../helpers.js').inPrivate;
|
let inPrivate = require('../helpers.js').inPrivate;
|
||||||
let hasExcludedSpamChannels = require('../helpers.js').hasExcludedSpamChannels;
|
let hasExcludedSpamChannels = require('../helpers.js').hasExcludedSpamChannels;
|
||||||
let hasExcludedSpamUsers = require('../helpers.js').hasExcludedSpamUsers;
|
let hasExcludedSpamUsers = require('../helpers.js').hasExcludedSpamUsers;
|
||||||
|
let vars = config.get('spam_detection');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add simple spam protection to your discord server.
|
* Add simple spam protection to your discord server.
|
||||||
|
@ -19,13 +20,13 @@ let hasExcludedSpamUsers = require('../helpers.js').hasExcludedSpamUsers;
|
||||||
exports.custom = ['antiSpam'];
|
exports.custom = ['antiSpam'];
|
||||||
|
|
||||||
exports.antiSpam = function(bot) {
|
exports.antiSpam = function(bot) {
|
||||||
const warnBuffer = 5;
|
const warnBuffer = vars.warnBuffer;
|
||||||
const maxBuffer = 10;
|
const maxBuffer = vars.maxBuffermsg;
|
||||||
const interval = 1500;
|
const interval = vars.intervalms;
|
||||||
const warningMessage = ', Stop spamming or you will be banned! This is your warning!';
|
const warningMessage = vars.warningMessage;
|
||||||
const banMessage = 'has been banned for spamming!';
|
const banMessage = vars.banMessage;
|
||||||
const maxDuplicatesWarning = 5;
|
const maxDuplicatesWarning = vars.maxDuplicatesWarning;
|
||||||
const maxDuplicatesBan = 10;
|
const maxDuplicatesBan = vars.maxDuplicatesBan;
|
||||||
|
|
||||||
bot.on('message', msg => {
|
bot.on('message', msg => {
|
||||||
if (inPrivate(msg) || msg.author.bot || hasPerms(msg) || hasExcludedSpamChannels(msg) || hasExcludedSpamUsers(msg)) {
|
if (inPrivate(msg) || msg.author.bot || hasPerms(msg) || hasExcludedSpamChannels(msg) || hasExcludedSpamUsers(msg)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue