UNPKG

@mkody/twitch-emoticons

Version:

Gets Twitch, BTTV, FFZ and 7TV emotes as well as parsing text to emotes!

1,596 lines (418 loc) 24.1 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>SevenTVEmote - 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="styles/prettify.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> <script src="scripts/nav.js" defer></script> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </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 > <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BTTVEmote.html">BTTVEmote</a><ul class='methods'><li data-type='method'><a href="BTTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="BTTVEmote.html#toObject">toObject</a></li><li data-type='method'><a href="BTTVEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="Channel.html">Channel</a><ul class='methods'><li data-type='method'><a href="Channel.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="Channel.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="Channel.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li></ul></li><li><a href="Collection.html">Collection</a><ul class='methods'><li data-type='method'><a href="Collection.html#filter">filter</a></li><li data-type='method'><a href="Collection.html#find">find</a></li><li data-type='method'><a href="Collection.html#map">map</a></li></ul></li><li><a href="Emote.html">Emote</a><ul class='methods'><li data-type='method'><a href="Emote.html#toObject">toObject</a></li></ul></li><li><a href="EmoteFetcher.html">EmoteFetcher</a><ul class='methods'><li data-type='method'><a href="EmoteFetcher.html#_cacheBTTVEmote">_cacheBTTVEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_cacheFFZEmote">_cacheFFZEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_cacheSevenTVEmote">_cacheSevenTVEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_cacheTwitchEmote">_cacheTwitchEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawBTTVEmotes">_getRawBTTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawFFZEmoteSet">_getRawFFZEmoteSet</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawFFZEmotes">_getRawFFZEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawSevenTVEmotes">_getRawSevenTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawTwitchEmotes">_getRawTwitchEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#_setupChannel">_setupChannel</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchTwitchEmotes">fetchTwitchEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fromObject">fromObject</a></li></ul></li><li><a href="EmoteParser.html">EmoteParser</a><ul class='methods'><li data-type='method'><a href="EmoteParser.html#parse">parse</a></li></ul></li><li><a href="FFZEmote.html">FFZEmote</a><ul class='methods'><li data-type='method'><a href="FFZEmote.html#toLink">toLink</a></li><li data-type='method'><a href="FFZEmote.html#toObject">toObject</a></li><li data-type='method'><a href="FFZEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="SevenTVEmote.html">SevenTVEmote</a><ul class='methods'><li data-type='method'><a href="SevenTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="SevenTVEmote.html#toObject">toObject</a></li><li data-type='method'><a href="SevenTVEmote.html#.fromObject">fromObject</a></li></ul></li><li><a href="TwitchEmote.html">TwitchEmote</a><ul class='methods'><li data-type='method'><a href="TwitchEmote.html#toLink">toLink</a></li><li data-type='method'><a href="TwitchEmote.html#toObject">toObject</a></li><li data-type='method'><a href="TwitchEmote.html#.fromObject">fromObject</a></li></ul></li></ul> </nav> <div id="main"> <h1 class="page-title">SevenTVEmote</h1> <section> <header> <h2> SevenTVEmote </h2> </header> <article> <div class="container-overview"> <h4 class="name" id="SevenTVEmote"><span class="type-signature"></span>new SevenTVEmote<span class="signature">(channel, id, data)</span><span class="type-signature"></span></h4> <dl class="details"> <dt class="tag-description">Description:</dt> <dd class="tag-description"><ul class="dummy"><li><p>A 7TV emote.</p></li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="struct_SevenTVEmote.js.html">struct/SevenTVEmote.js</a>, <a href="struct_SevenTVEmote.js.html#line5">line 5</a> </li></ul></dd> </dl> <h5 class="h5-parameters">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>channel</code></td> <td class="type"> <span class="param-type"><a href="Channel.html">Channel</a></span> </td> <td class="description last"><p>Channel this emote belongs to.</p></td> </tr> <tr> <td class="name"><code>id</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>ID of the emote.</p></td> </tr> <tr> <td class="name"><code>data</code></td> <td class="type"> <span class="param-type">data</span> </td> <td class="description last"><p>The raw emote data.</p></td> </tr> </tbody> </table> </div> <h3 class="subsection-title">Extends</h3> <ul> <li><a href="Emote.html">Emote</a></li> </ul> <h3 class="subsection-title">Members</h3> <h4 class="name" id="animated"><span class="type-signature"></span>animated<span class="type-signature"> :boolean</span></h4> <dl class="details"> <dt class="tag-description">Description:</dt> <dd class="tag-description"><ul class="dummy"><li><p>If emote is animated.</p></li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="struct_SevenTVEmote.js.html">struct/SevenTVEmote.js</a>, <a href="struct_SevenTVEmote.js.html#line49">line 49</a> </li></ul></dd> </dl> <div class="description usertext"> <p>If emote is animated.</p> </div> <h5 class="h5-types">Type:</h5> <ul> <li> <span class="param-type">boolean</span> </li> </ul> <h4 class="name" id="channel"><span class="type-signature"></span>channel<span class="type-signature"> :<a href="Channel.html">Channel</a></span></h4> <dl class="details"> <dt class="tag-description">Description:</dt> <dd class="tag-description"><ul class="dummy"><li><p>The channel this emote belongs to.<br> Only accurate and constant on Twitch emotes.<br> For other types of emotes, use the <code>owner</code> or <code>ownerName</code> property.</p></li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="struct_Emote.js.html">struct/Emote.js</a>, <a href="struct_Emote.js.html#line26">line 26</a> </li></ul></dd> <dt class="tag-overrides">Overrides:</dt> <dd class="tag-overrides"><ul class="dummy"><li> <a href="Emote.html#channel">Emote#channel</a> </li></ul></dd> </dl> <div class="description usertext"> <p>The channel this emote belongs to.<br> Only accurate and constant on Twitch emotes.<br> For other types of emotes, use the <code>owner</code> or <code>ownerName</code> property.</p> </div> <h5 class="h5-types">Type:</h5> <ul> <li> <span class="param-type"><a href="Channel.html">Channel</a></span> </li> </ul> <h4 class="name" id="code"><span class="type-signature"></span>code<span class="type-signature"> :string</span></h4> <dl class="details"> <dt class="tag-description">Description:</dt> <dd class="tag-description"><ul class="dummy"><li><p>The code or name of the emote.</p></li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="struct_Emote.js.html">struct/Emote.js</a>, <a href="struct_Emote.js.html#line49">line 49</a> </li></ul></dd> <dt class="tag-overrides">Overrides:</dt> <dd class="tag-overrides"><ul class="dummy"><li> <a href="Emote.html#code">Emote#code</a> </li></ul></dd> </dl> <div class="description usertext"> <p>The code or name of the emote.</p> </div> <h5 class="h5-types">Type:</h5> <ul> <li> <span class="param-type">string</span> </li> </ul> <h4 class="name" id="fetcher"><span class="type-signature"></span>fetcher<span class="type-signature"> :<a href="EmoteFetcher.html">EmoteFetcher</a></span></h4> <dl class="details"> <dt class="tag-description">Description:</dt> <dd class="tag-description"><ul class="dummy"><li><p>The emote fetcher.</p></li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="struct_Emote.js.html">struct/Emote.js</a>, <a href="struct_Emote.js.html#line18">line 18</a> </li></ul></dd> <dt class="tag-overrides">Overrides:</dt> <dd class="tag-overrides"><ul class="dummy"><li> <a href="Emote.html#fetcher">Emote#fetcher</a> </li></ul></dd> </dl> <div class="description usertext"> <p>The emote fetcher.</p> </div> <h5 class="h5-types">Type:</h5> <ul> <li> <span class="param-type"><a href="EmoteFetcher.html">EmoteFetcher</a></span> </li> </ul> <h4 class="name" id="id"><span class="type-signature"></span>id<span class="type-signature"> :string</span></h4> <dl class="details"> <dt class="tag-description">Description:</dt> <dd class="tag-description"><ul class="dummy"><li><p>The ID of this emote.</p></li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="struct_Emote.js.html">struct/Emote.js</a>, <a href="struct_Emote.js.html#line32">line 32</a> </li></ul></dd> <dt class="tag-overrides">Overrides:</dt> <dd class="tag-overrides"><ul class="dummy"><li> <a href="Emote.html#id">Emote#id</a> </li></ul></dd> </dl> <div class="description usertext"> <p>The ID of this emote.</p> </div> <h5 class="h5-types">Type:</h5> <ul> <li> <span class="param-type">string</span> </li> </ul> <h4 class="name" id="imageType"><span class="type-signature"></span>imageType<span class="type-signature"> :string</span></h4> <dl class="details"> <dt class="tag-description">Description:</dt> <dd class="tag-description"><ul class="dummy"><li><p>The image type of the emote.</p></li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="struct_SevenTVEmote.js.html">struct/SevenTVEmote.js</a>, <a href="struct_SevenTVEmote.js.html#line55">line 55</a> </li></ul></dd> </dl> <div class="description usertext"> <p>The image type of the emote.</p> </div> <h5 class="h5-types">Type:</h5> <ul> <li> <span class="param-type">string</span> </li> </ul> <h4 class="name" id="owner"><span class="type-signature type-signature-readonly, nullable">(readonly, nullable) </span>owner<span class="type-signature"> :<a href="Channel.html">Channel</a></span></h4> <dl class="details"> <dt class="tag-description">Description:</dt> <dd class="tag-description"><ul class="dummy"><li><p>The channel of this emote's creator.<br> Not guaranteed to contain the emote, or be cached.</p></li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="struct_SevenTVEmote.js.html">struct/SevenTVEmote.js</a>, <a href="struct_SevenTVEmote.js.html#line23">line 23</a> </li></ul></dd> </dl> <div class="description usertext"> <p>The channel of this emote's creator.<br> Not guaranteed to contain the emote, or be cached.</p> </div> <h5 class="h5-types">Type:</h5> <ul> <li> <span class="param-type"><a href="Channel.html">Channel</a></span> </li> </ul> <h4 class="name" id="ownerName"><span class="type-signature type-signature-nullable">(nullable) </span>ownerName<span class="type-signature"> :string</span></h4> <dl class="details"> <dt class="tag-description">Description:</dt> <dd class="tag-description"><ul class="dummy"><li><p>The name of the emote creator's channel.</p></li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="struct_SevenTVEmote.js.html">struct/SevenTVEmote.js</a>, <a href="struct_SevenTVEmote.js.html#line35">line 35</a> </li></ul></dd> </dl> <div class="description usertext"> <p>The name of the emote creator's channel.</p> </div> <h5 class="h5-types">Type:</h5> <ul> <li> <span class="param-type">string</span> </li> </ul> <h4 class="name" id="sizes"><span class="type-signature"></span>sizes<span class="type-signature"> :Array.&lt;string></span></h4> <dl class="details"> <dt class="tag-description">Description:</dt> <dd class="tag-description"><ul class="dummy"><li><p>Available image sizes.</p></li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="struct_SevenTVEmote.js.html">struct/SevenTVEmote.js</a>, <a href="struct_SevenTVEmote.js.html#line41">line 41</a> </li></ul></dd> </dl> <div class="description usertext"> <p>Available image sizes.</p> </div> <h5 class="h5-types">Type:</h5> <ul> <li> <span class="param-type">Array.&lt;string></span> </li> </ul> <h4 class="name" id="type"><span class="type-signature"></span>type<span class="type-signature"> :string</span></h4> <dl class="details"> <dt class="tag-description">Description:</dt> <dd class="tag-description"><ul class="dummy"><li><p>The type of this emote.<br> Either <code>twitch</code>, <code>bttv</code>, <code>ffz</code>, or '7tv'.</p></li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="struct_Emote.js.html">struct/Emote.js</a>, <a href="struct_Emote.js.html#line39">line 39</a> </li></ul></dd> <dt class="tag-overrides">Overrides:</dt> <dd class="tag-overrides"><ul class="dummy"><li> <a href="Emote.html#type">Emote#type</a> </li></ul></dd> </dl> <div class="description usertext"> <p>The type of this emote.<br> Either <code>twitch</code>, <code>bttv</code>, <code>ffz</code>, or '7tv'.</p> </div> <h5 class="h5-types">Type:</h5> <ul> <li> <span class="param-type">string</span> </li> </ul> <h3 class="subsection-title">Methods</h3> <h4 class="name" id="toLink"><span class="type-signature"></span>toLink<span class="signature">(size)</span><span class="type-signature"> &rarr; {string}</span></h4> <dl class="details"> <dt class="tag-description">Description:</dt> <dd class="tag-description"><ul class="dummy"><li><p>Gets the image link of the emote.</p></li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="struct_SevenTVEmote.js.html">struct/SevenTVEmote.js</a>, <a href="struct_SevenTVEmote.js.html#line63">line 63</a> </li></ul></dd> </dl> <h5 class="h5-parameters">Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>size</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="default"> <code>0</code> </td> <td class="description last"><p>The size of the image.</p></td> </tr> </tbody> </table> <h5 class="h5-returns">Returns:</h5> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> <h4 class="name" id="toObject"><span class="type-signature"></span>toObject<span class="signature">()</span><span class="type-signature"> &rarr; {object}</span></h4> <dl class="details"> <dt class="tag-description">Description:</dt> <dd class="tag-description"><ul class="dummy"><li><p>Override for <code>toObject</code>.<br> Will result in an Object representation of a SevenTVEmote</p></li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="struct_SevenTVEmote.js.html">struct/SevenTVEmote.js</a>, <a href="struct_SevenTVEmote.js.html#line73">line 73</a> </li></ul></dd> <dt class="tag-overrides">Overrides:</dt> <dd class="tag-overrides"><ul class="dummy"><li> <a href="Emote.html#toObject">Emote#toObject</a> </li></ul></dd> </dl> <h5 class="h5-returns">Returns:</h5> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">object</span> </dd> </dl> <h4 class="name" id=".fromObject"><span class="type-signature type-signature-static">(static) </span>fromObject<span class="signature">(emoteObject<span class="signature-attributes">opt</span>, channel<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="SevenTVEmote.html">SevenTVEmote</a>}</span></h4> <dl class="details"> <dt class="tag-description">Description:</dt> <dd class="tag-description"><ul class="dummy"><li><p>Converts an emote Object into a SevenTVEmote</p></li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="struct_SevenTVEmote.js.html">struct/SevenTVEmote.js</a>, <a href="struct_SevenTVEmote.js.html#line89">line 89</a> </li></ul></dd> </dl> <h5 class="h5-parameters">Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>emoteObject</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>Object representation of this emote</p></td> </tr> <tr> <td class="name"><code>channel</code></td> <td class="type"> <span class="param-type"><a href="Channel.html">Channel</a></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>Channel this emote belongs to.</p></td> </tr> </tbody> </table> <h5 class="h5-returns">Returns:</h5> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type"><a href="SevenTVEmote.html">SevenTVEmote</a></span> </dd> </dl> </article> </section> </div> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. </footer> <script>prettyPrint();</script> <script src="scripts/polyfill.js"></script> <script src="scripts/linenumber.js"></script> </body> </html>