discord-anti-spam
Version:
An easy to setup package that help you integration of anti-spam feature in your discord bot.
1,553 lines (375 loc) • 17.4 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>AntiSpamClient - 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">
<h1 class="page-title">AntiSpamClient</h1>
<section>
<header>
<h2>
AntiSpamClient
</h2>
<div class="class-description"><p>Main AntiSpam class</p></div>
</header>
<article>
<div class="container-overview">
<div class="section-method">
<h2>Constructor</h2>
<h4 class="name" id="AntiSpamClient"><span class="type-signature"></span>new AntiSpamClient<span class="signature">(options)</span><span class="type-signature"></span></h4>
<dl class="details">
</dl>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type"><code><a href="global.html#AntiSpamClientOptions">AntiSpamClientOptions</a></code></span>
</td>
<td class="description last">
<p>The options for this AntiSpam client instance</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<h3 class="subsection-title">Members</h3>
<div class="section-members">
<h4 class="name" id="cache"><span class="type-signature"></span>cache<span class="type-signature"> :<a href="global.html#AntiSpamCache">AntiSpamCache</a></span></h4>
<div class="description">
<p>The cache for this AntiSpam client instance</p>
</div>
<dl class="details">
</dl>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><code><a href="global.html#AntiSpamCache">AntiSpamCache</a></code></span>
</li>
</ul>
</div>
<div class="section-members">
<h4 class="name" id="options"><span class="type-signature"></span>options<span class="type-signature"> :<a href="global.html#AntiSpamClientOptions">AntiSpamClientOptions</a></span></h4>
<div class="description">
<p>The options for this AntiSpam client instance</p>
</div>
<dl class="details">
</dl>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><code><a href="global.html#AntiSpamClientOptions">AntiSpamClientOptions</a></code></span>
</li>
</ul>
</div>
<h3 class="subsection-title">Methods</h3>
<div class="section-method">
<h4 class="name" id="message"><span class="type-signature">(async) </span>message<span class="signature">(message)</span><span class="type-signature"> → {Promise.<boolean>}</span></h4>
<div class="description">
<p>Checks a message.</p>
</div>
<dl class="details">
</dl>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>message</code></td>
<td class="type">
<span class="param-type"><code>Discord.Message</code></span>
</td>
<td class="description last">
<p>The message to check.</p>
</td>
</tr>
</tbody>
</table>
<div class="section-returns">
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type:
</dt>
<dd>
<span class="param-type"><code>Promise.<boolean></code></span>
</dd>
</dl>
<div class="param-desc">
<p>Whether the message has triggered a threshold.</p>
</div>
</div>
<div class="section-examples">
<h5>Example</h5>
<pre class="prettyprint"><code>client.on('message', (msg) => {
antiSpam.message(msg);
});</code></pre>
</div>
</div>
<div class="section-method">
<h4 class="name" id="reset"><span class="type-signature"></span>reset<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Reset the cache of this AntiSpam client instance.</p>
</div>
<dl class="details">
</dl>
</div>
<div class="section-method">
<h4 class="name" id="userleave"><span class="type-signature">(async) </span>userleave<span class="signature">(member)</span><span class="type-signature"> → {Promise.<boolean>}</span></h4>
<div class="description">
<p>Checks if the user left the server to remove him from the cache!</p>
</div>
<dl class="details">
</dl>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>member</code></td>
<td class="type">
<span class="param-type"><code>Discord.GuildMember</code></span>
</td>
<td class="description last">
<p>The member to remove from the cache.</p>
</td>
</tr>
</tbody>
</table>
<div class="section-returns">
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type:
</dt>
<dd>
<span class="param-type"><code>Promise.<boolean></code></span>
</dd>
</dl>
<div class="param-desc">
<p>Whether the member has been removed</p>
</div>
</div>
<div class="section-examples">
<h5>Example</h5>
<pre class="prettyprint"><code>client.on('guildMemberRemove', (member) => {
antiSpam.userleave(member);
});</code></pre>
</div>
</div>
<h3 class="subsection-title">Events</h3>
<div class="section-method">
<h4 class="name" id="event:banAdd">banAdd</h4>
<div class="description">
<p>Emitted when a member gets banned.</p>
</div>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>member</code></td>
<td class="type">
<span class="param-type"><code>Discord.GuildMember</code></span>
</td>
<td class="description last"><p>The member that was banned.</p></td>
</tr>
<tr>
<td class="name"><code>channel</code></td>
<td class="type">
<span class="param-type"><code>Discord.TextChannel</code></span>
</td>
<td class="description last"><p>The channel that the spam messages was sent in.</p></td>
</tr>
<tr>
<td class="name"><code>message</code></td>
<td class="type">
<span class="param-type"><code>Discord.Message</code></span>
</td>
<td class="description last"><p>The message that was sent as last. Could be used to find the guild object etc..</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
</div>
<div class="section-method">
<h4 class="name" id="event:kickAdd">kickAdd</h4>
<div class="description">
<p>Emitted when a member gets kicked.</p>
</div>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>member</code></td>
<td class="type">
<span class="param-type"><code>Discord.GuildMember</code></span>
</td>
<td class="description last"><p>The member that was kicked.</p></td>
</tr>
<tr>
<td class="name"><code>channel</code></td>
<td class="type">
<span class="param-type"><code>Discord.TextChannel</code></span>
</td>
<td class="description last"><p>The channel that the spam messages was sent in.</p></td>
</tr>
<tr>
<td class="name"><code>message</code></td>
<td class="type">
<span class="param-type"><code>Discord.Message</code></span>
</td>
<td class="description last"><p>The message that was sent as last. Could be used to find the guild object etc..</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
</div>
<div class="section-method">
<h4 class="name" id="event:muteAdd">muteAdd</h4>
<div class="description">
<p>Emitted when a member gets muted.</p>
</div>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>member</code></td>
<td class="type">
<span class="param-type"><code>Discord.GuildMember</code></span>
</td>
<td class="description last"><p>The member that was muted.</p></td>
</tr>
<tr>
<td class="name"><code>channel</code></td>
<td class="type">
<span class="param-type"><code>Discord.TextChannel</code></span>
</td>
<td class="description last"><p>The channel that the spam messages was sent in.</p></td>
</tr>
<tr>
<td class="name"><code>message</code></td>
<td class="type">
<span class="param-type"><code>Discord.Message</code></span>
</td>
<td class="description last"><p>The message that was sent as last. Could be used to find the guild object etc..</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
</div>
<div class="section-method">
<h4 class="name" id="event:warnAdd">warnAdd</h4>
<div class="description">
<p>Emitted when a member gets warned.</p>
</div>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>member</code></td>
<td class="type">
<span class="param-type"><code>Discord.GuildMember</code></span>
</td>
<td class="description last"><p>The member that was warned.</p></td>
</tr>
<tr>
<td class="name"><code>channel</code></td>
<td class="type">
<span class="param-type"><code>Discord.TextChannel</code></span>
</td>
<td class="description last"><p>The channel that the spam messages was sent in.</p></td>
</tr>
<tr>
<td class="name"><code>message</code></td>
<td class="type">
<span class="param-type"><code>Discord.Message</code></span>
</td>
<td class="description last"><p>The message that was sent as last. Could be used to find the guild object etc..</p></td>
</tr>
</tbody>
</table>
<dl class="details">
</dl>
</div>
</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>