UNPKG

discord-anti-spam

Version:

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

116 lines (80 loc) 5.72 kB
<!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"> </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="AntiSpamClient.html">AntiSpamClient</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="AntiSpamClient.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="AntiSpamClient.html#reset">reset</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="AntiSpamClient.html#userleave">userleave</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="AntiSpamClient.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="AntiSpamClient.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="AntiSpamClient.html#event:muteAdd">muteAdd</a></span></li><li class="nav-heading"><span class="nav-item-type type-event">E</span><span class="nav-item-name"><a href="AntiSpamClient.html#event:warnAdd">warnAdd</a></span></li><li class="nav-heading"><a href="global.html">Globals</a></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 { Client, GatewayIntentBits, Partial } = require(&quot;discord.js&quot;); const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages], partials: [Partials.Channel], }); const AntiSpam = require(&quot;discord-anti-spam&quot;); const antiSpam = new AntiSpam({ warnThreshold: 3, // Amount of messages sent in a row that will cause a warning. muteTreshold: 6, // Amount of messages sent in a row that will cause a mute. kickTreshold: 9, // Amount of messages sent in a row that will cause a kick. banTreshold: 12, // Amount of messages sent in a row that will cause a ban. warnMessage: &quot;Stop spamming!&quot;, // Message sent in the channel when a user is warned. muteMessage: &quot;You have been muted for spamming!&quot;, // Message sent in the channel when a user is muted. kickMessage: &quot;You have been kicked for spamming!&quot;, // Message sent in the channel when a user is kicked. banMessage: &quot;You have been banned for spamming!&quot;, // Message sent in the channel when a user is banned. unMuteTime: 60, // Time in minutes before the user will be able to send messages again. verbose: true, // Whether or not to log every action in the console. removeMessages: true, // Whether or not to remove all messages sent by the user. ignoredPermissions: [PermissionFlagsBits.Administrator], // If the user has the following permissions, ignore him. // For more options, see the documentation: }); client.on(&quot;ready&quot;, () => console.log(`Logged in as ${client.user.tag}.`)); client.on(&quot;messageCreate&quot;, (message) => antiSpam.message(message)); client.login(&quot;YOUR_SUPER_SECRET_TOKEN&quot;); </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> <h2>📝 License</h2> <p>Copyright © 2019 <a href="https://github.com/Michael-J-Scofield">Michael-J-Scofield</a><br /> This project is MIT licensed.</p> <hr></article> </section> </div> <br class="clear"> <footer> Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a> using the Minami theme. </footer> <script>prettyPrint();</script> <script src="scripts/linenumber.js"></script> </body> </html>