<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title>Home - Documentation</title> <script src="scripts/prettify/prettify.js"></script> <script src="scripts/prettify/lang-css.js"></script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css"> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> <link rel="icon" type="image/png" href="img/antispam.png"> </head> <body> <input type="checkbox" id="nav-trigger" class="nav-trigger" /> <label for="nav-trigger" class="navicon-button x"> <div class="navicon"></div> </label> <label for="nav-trigger" class="overlay"></label> <nav> <li class="nav-link nav-home-link"><a href="index.html">Home</a></li><li class="nav-heading">Classes</li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="AntiSpam.html">AntiSpam</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="AntiSpam.html#message">message</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="AntiSpam.html#resetData">resetData</a></span></li><li class="nav-heading">Events</li><li class="nav-heading"><span class="nav-item-type type-event">E</span><span class="nav-item-name"><a href="AntiSpam.html#event:banAdd">banAdd</a></span></li><li class="nav-heading"><span class="nav-item-type type-event">E</span><span class="nav-item-name"><a href="AntiSpam.html#event:error">error</a></span></li><li class="nav-heading"><span class="nav-item-type type-event">E</span><span class="nav-item-name"><a href="AntiSpam.html#event:kickAdd">kickAdd</a></span></li><li class="nav-heading"><span class="nav-item-type type-event">E</span><span class="nav-item-name"><a href="AntiSpam.html#event:spamThresholdBan">spamThresholdBan</a></span></li><li class="nav-heading"><span class="nav-item-type type-event">E</span><span class="nav-item-name"><a href="AntiSpam.html#event:spamThresholdKick">spamThresholdKick</a></span></li><li class="nav-heading"><span class="nav-item-type type-event">E</span><span class="nav-item-name"><a href="AntiSpam.html#event:spamThresholdWarn">spamThresholdWarn</a></span></li><li class="nav-heading"><span class="nav-item-type type-event">E</span><span class="nav-item-name"><a href="AntiSpam.html#event:warnAdd">warnAdd</a></span></li><li class="nav-heading"><a href="global.html">Globals</a></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#format">format</a></span></li> </nav> <div id="main"> <section class="readme"> <article><p align="center"><a href="https://nodei.co/npm/discord-anti-spam/"><img src="https://nodei.co/npm/discord-anti-spam.png"></a></p> <h1>discord-anti-spam.js</h1> <p>A simple module with quick setup and different options to implement anti-spam features in your bot.</p> <h2>Installation</h2> <p>To install this module type the following command in your console:</p> <pre class="prettyprint source"><code>npm i discord-anti-spam </code></pre> <h2>Documentation</h2> <p>You can see the package documentation <a href="https://discord-anti-spam.js.org"><strong>here</strong></a>.</p> <h2>Example</h2> <p>Example of a basic bot handling spam messages using this module.</p> <pre class="prettyprint source lang-js"><code>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. muteThreshold: 4, // Amount of messages sent in a row that will cause a mute kickThreshold: 7, // Amount of messages sent in a row that will cause a kick. 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. kickMessage: '**{user_tag}** has been kicked for spamming.', // Message that will be sent in chat upon kicking a user. muteMessage: '**{user_tag}** has been muted for spamming.',// Message that will be sent in chat upon muting a user. banMessage: '**{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. muteRoleName: "Muted", // Name of the role that will be given to muted users! removeMessages: true // If the bot should remove all the spam messages when taking action on a user! // And many more options... See the documentation. }); client.on('ready', () => console.log(`Logged in as ${client.user.tag}.`)); client.on('message', (message) => antiSpam.message(message)); client.login('YOUR_SUPER_SECRET_TOKEN'); </code></pre> <h2>Support Server</h2> <p>Join our <a href="https://discord.gg/KQgDfGr">Support Server</a> where we help you with issues regarding the module.</p> <h2>Bug Reports</h2> <p>If you have any bugs or trouble setting the module up, feel free to open an issue on <a href="https://github.com/Michael-J-Scofield/discord-anti-spam">Github</a></p></article> </section> </div> <br class="clear"> <footer> Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> using the Minami theme. </footer> <script>prettyPrint();</script> <script src="scripts/linenumber.js"></script> </body> </html>