JSPM

  • Created
  • Published
  • Downloads 101
  • Score
    100M100P100Q86905F
  • License MIT

An easy to setup package that help you integration of anti-spam feature in your discord bot.

Package Exports

  • discord-anti-spam

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (discord-anti-spam) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

discord-anti-spam.js

A simple module with quick setup and different options to implement anti-spam features in your bot.

Installation

To install this module type the following command in your console:

npm i discord-anti-spam

Documentation

You can see the package documentation here.

Example

Example of a basic bot handling spam messages using this module.

const Discord = require('discord.js');
const client = new Discord.Client();
const AntiSpam = require('discord-anti-spam');
const antiSpam = new AntiSpam({
    warnThreshold: 3, // Amount of messages sent in a row that will cause a warning.
    kickThreshold: 7, // Amount of messages sent in a row that will cause a ban.
    banThreshold: 7, // Amount of messages sent in a row that will cause a ban.
    maxInterval: 2000, // Amount of time (in milliseconds) in which messages are considered spam.
    warnMessage: '{@user}, Please stop spamming.', // Message that will be sent in chat upon warning a user.
    banMessage: '**{user_tag}** has been kicked for spamming.', // Message that will be sent in chat upon banning a user.
    anMessage: '**{user_tag}** has been banned for spamming.', // Message that will be sent in chat upon banning a user.
    maxDuplicatesWarning: 7, // Amount of duplicate messages that trigger a warning.
    maxDuplicatesKick: 10, // Amount of duplicate messages that trigger a warning.
    maxDuplicatesBan: 12, // Amount of duplicate messages that trigger a warning.
    exemptPermissions: [ 'ADMINISTRATOR'], // Bypass users with any of these permissions.
    ignoreBots: true, // Ignore bot messages.
    verbose: true, // Extended Logs from module.
    ignoredUsers: [], // Array of User IDs that get ignored.
    // And many more options... See the documentation.
});

client.on('ready', () => console.log(`Logged in as ${client.user.tag}.`));

client.on('message', antiSpam.message);

client.login('YOUR_SUPER_SECRET_TOKEN');

Support Server

Join our Support Server where we help you with issues regarding the module.

Bug Reports

If you have any bugs or trouble setting the module up, feel free to open an issue on Github