Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

antispammer

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

antispammer

Have the ability to check if a user is spamming and act upon it!

  • 1.0.0
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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');

Functions:

check:
antispam.check(
  id, //string
  timeout, //integer
  threshold, //integer
  notSpamming, //function
  spamming //function
);

Adds a use by a user and tests for spamming with set thresholds.

clear:
antispam.clear(
  id //string
);

Clear the user from the spammer list.

Example:

const antispam = require('antispammer');
var user = 123;
// The user ID
function notSpamming() {
  console.log(`${user} is not spamming!`);
}
// Defining what happens when the user is not spamming
function spamming() {
  console.log('Stop spammer!');
}
// Defining what happens when the user is spamming

for (i=0;i<5;i++) {
antispam.check(user, 30000, 3, notSpamming, spamming);
}

antispam.clear(user);
antispam.check(user, 30000, 3, notSpamming, spamming);

Expected Output:

123 is not spamming!
123 is not spamming!
123 is not spamming!
123 is not spamming!
Stop spammer!
123 is not spamming!

Keywords

FAQs

Package last updated on 04 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc