UNPKG

vnftjs

Version:

Discord CommandHandler for TypeScript or JavaScript

1,010 lines (247 loc) 13.2 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title>CommandHandler - 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="CommandHandler.html">CommandHandler</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="CommandHandler.html#addCommand">addCommand</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="CommandHandler.html#addScript">addScript</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="CommandHandler.html#commandListener">commandListener</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="CommandHandler.html#enableHelp">enableHelp</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="CommandHandler.html#loadCommands">loadCommands</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="CommandHandler.html#loadScripts">loadScripts</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="CommandHandler.html#scriptTrigger">scriptTrigger</a></span></li> </nav> <div id="main"> <h1 class="page-title">CommandHandler</h1> <section> <header> <h2> CommandHandler </h2> </header> <article> <div class="container-overview"> <div class="section-method"> <h4 class="name" id="CommandHandler"><span class="type-signature"></span>new CommandHandler<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>The constructor of the CommandHandler class.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="CommandHandler.js.html">CommandHandler.js</a>, <a href="CommandHandler.js.html#line11">line 11</a> </li></ul></dd> </dl> </div> </div> <h3 class="subsection-title">Methods</h3> <div class="section-method"> <h4 class="name" id="addCommand"><span class="type-signature"></span>addCommand<span class="signature">(command)</span><span class="type-signature"></span></h4> <div class="description"> <p>Adds a Command to the List of known Commands</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="CommandHandler.js.html">CommandHandler.js</a>, <a href="CommandHandler.js.html#line43">line 43</a> </li></ul></dd> </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>command</code></td> <td class="type"> <span class="param-type"><code>Command</code></span> </td> <td class="description last"> <p>The Command that should be added.</p> </td> </tr> </tbody> </table> </div> <div class="section-method"> <h4 class="name" id="addScript"><span class="type-signature"></span>addScript<span class="signature">(script)</span><span class="type-signature"></span></h4> <div class="description"> <p>Adds a Script to the List of known Scripts. Triggers it if Discord Client already ready.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="CommandHandler.js.html">CommandHandler.js</a>, <a href="CommandHandler.js.html#line51">line 51</a> </li></ul></dd> </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>script</code></td> <td class="type"> <span class="param-type"><code>Script</code></span> </td> <td class="description last"> <p>The Script that should be added.</p> </td> </tr> </tbody> </table> </div> <div class="section-method"> <h4 class="name" id="commandListener"><span class="type-signature"></span>commandListener<span class="signature">(message)</span><span class="type-signature"></span></h4> <div class="description"> <p>Checks an Message for a Command and executes it if one has been found.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="CommandHandler.js.html">CommandHandler.js</a>, <a href="CommandHandler.js.html#line23">line 23</a> </li></ul></dd> </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>Message</code></span> </td> <td class="description last"> <p>The Discord Message that should be checked for a Command.</p> </td> </tr> </tbody> </table> </div> <div class="section-method"> <h4 class="name" id="enableHelp"><span class="type-signature"></span>enableHelp<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>adds a .help command</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="CommandHandler.js.html">CommandHandler.js</a>, <a href="CommandHandler.js.html#line118">line 118</a> </li></ul></dd> </dl> </div> <div class="section-method"> <h4 class="name" id="loadCommands"><span class="type-signature"></span>loadCommands<span class="signature">(target_path)</span><span class="type-signature"></span></h4> <div class="description"> <p>Loads all exported Commands inside of the given Path (goes also through the subfolders)</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="CommandHandler.js.html">CommandHandler.js</a>, <a href="CommandHandler.js.html#line71">line 71</a> </li></ul></dd> </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>target_path</code></td> <td class="type"> </td> <td class="description last"> <p>The Path that should be crawled for exported Commands</p> </td> </tr> </tbody> </table> </div> <div class="section-method"> <h4 class="name" id="loadScripts"><span class="type-signature"></span>loadScripts<span class="signature">(target_path)</span><span class="type-signature"></span></h4> <div class="description"> <p>Adds all exported Scripts inside of the given Path</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="CommandHandler.js.html">CommandHandler.js</a>, <a href="CommandHandler.js.html#line95">line 95</a> </li></ul></dd> </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>target_path</code></td> <td class="type"> </td> <td class="description last"> <p>The Path that should be crawled for exported Scripts</p> </td> </tr> </tbody> </table> </div> <div class="section-method"> <h4 class="name" id="scriptTrigger"><span class="type-signature"></span>scriptTrigger<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>Triggers all scripts that hasn't been triggered yet</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="CommandHandler.js.html">CommandHandler.js</a>, <a href="CommandHandler.js.html#line60">line 60</a> </li></ul></dd> </dl> </div> </article> </section> </div> <br class="clear"> <footer> Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.2</a> on Thu May 23 2019 19:12:26 GMT+0200 (GMT+02:00) using the Minami theme. </footer> <script>prettyPrint();</script> <script src="scripts/linenumber.js"></script> </body> </html>