Antispammer
Antispammer allows you to check if a user is spamming, which is set through a threshold of uses in an amount of time. You get to set what happens if the user is spamming and what happens when they aren't. Input a user by ID every time they do something to allow this to happen!
Usage:
Install:
npm install antispammer
const antispam = require('antispammer');
Create a new filter:
const spamfilter({
time: number,
max: number,
onGood: function,
onBad: function,
});
Methods:
antispam.setTime(time)
.setMax(number)
antispam.setMax(threshold)
.setOnGood(function)
antispam.setOnGood(notSpammingFunction)
.setOnBad(function)
antispam.setOnBad(spammingFunction)
.check(id)
antispam.check(string)
.clear(id)
antispam.clear(string)
.has(id)
antispam.has(string)
.list()
antispam.list()
Example:
const antispam = require('antispammer');
const user = 123;
const spamFilter = new antispam({
time: 30000,
max: 20
});
function spammer() {
console.log('Spammer no spamming!');
spamFilter.clear(user);
};
spamFilter.setOnBad(spammer);
spamFilter(user);
console.log(spamFilter.list());
console.log(spamFilter.has('123'));