Socket
Socket
Sign inDemoInstall

easyantispam

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    easyantispam

Easy Anti Spam package used for Discord Bots to prevent invites link from other servers and flooded/duplicated messages.


Version published
Weekly downloads
8
increased by14.29%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Easy Anti Spam

NPM Version GitHub issues NPM License NPM Downloads Discord GitBook NPM

This package have 2 principal functions:

  • Handle URLs spammed.
  • Handle flood messages and repeated messages.

Summary

Support

GitBook Page You can contact us on your Discord server

Installation

Using NPM:

npm install easyantispam

Using Yarn (Linux):

yarn add easyantispam

Examples

Basic use

const Discord = require('discord.js');
const client = new Discord.Client();
const EasyAntiSpam = require('easyantispam'); // Js
// TypeScript: import EasyAntiSpam from "easyantispam";

Easy = new EasyAntiSpam.Config({ urls: true, canKick: true, canBan: true, warnRow: 3 }); // And more config variables...

client.once('ready', () => console.log('Bot is online!'));

client.on('message', async message => {
    Easy.run(message);
});

client.login('TOKEN_HERE');

API

The Config is to initialize the Anti Spam system. The run() is placed inside the message event to analyze all received messages.

Config(options: EasyAntiSpamOptions) returns Promise

  • EasyAntiSpamOptions - List of options can be found here.

run(message)

  • message - The message to be analyzed.

Options

Properties marked with ? are optional. All options are predefined

EasyAntiSpamOptions

{
    urls?: false, // Delete or not all URLS
    discordInvites?: false, // Delete or not Discord Invites 
    allowUrlImages?: true, // Delete or not Images provided by URL
    dm?: false, // If true, send your message with URL to private message
    messageLink?: "Hey {author}, you are not allowed to send spam.", // Message sent when a user send an URL
    messageFlood?: "Hey {author}, stop doing spam.", // Message sent when a user is warned for flood
    messageKicked?: "{author} has been kicked.", // Message sent when a user is kicked
    messageBanned?: "{author} has been banned.", // Message sent when a user is banned
    allowBots?: true, // Allow bots
    allowedPerms?: [], // List of permissions allowed to do spam
    warnRow?: 4, // Messages sent in a row to be warned
    kickRow?: 6, // Messages sent in a row to be kicked
    banRow?: 8, // Messages sent in a row to be banned
    rowInterval?: 2000, // Amount of time in ms to consider spam (2s)
    warnDuplicates?: 5, // Duplicated messages sent to be warned
    kickDuplicates?: 10, // Duplicated messages sent to be kicked
    banDuplicates?: 15, // Duplicated messages sent to be banned
    duplicatesInterval?: 600000, // Amount of time in ms to consider spam (10m)
    canKick?: false, // If false, the bot dont kick users
    canBan?: false, // If false, the bot dont ban users
    banDays?: 1, // Amount of days of Ban
}

warningMessageOptions

  • {author} - Returns a mentioned author of the message.

License

MIT

Keywords

FAQs

Last updated on 05 Jan 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc