discord-player-play-dl/docs/Player.html
2020-02-02 11:20:21 +01:00

2719 lines
No EOL
29 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Player - 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="Player.html">Player</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Player.html#addToQueue">addToQueue</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Player.html#clearQueue">clearQueue</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Player.html#getQueue">getQueue</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Player.html#isPlaying">isPlaying</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Player.html#nowPlaying">nowPlaying</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Player.html#pause">pause</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Player.html#play">play</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Player.html#resume">resume</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Player.html#setQueue">setQueue</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Player.html#setRepeatMode">setRepeatMode</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Player.html#setVolume">setVolume</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Player.html#skip">skip</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Player.html#stop">stop</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="Queue.html">Queue</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="Song.html">Song</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="Queue.html#event:channelEmpty">channelEmpty</a></span></li><li class="nav-heading"><span class="nav-item-type type-event">E</span><span class="nav-item-name"><a href="Queue.html#event:end">end</a></span></li><li class="nav-heading"><span class="nav-item-type type-event">E</span><span class="nav-item-name"><a href="Queue.html#event:songChanged">songChanged</a></span></li><li class="nav-heading"><a href="global.html">Globals</a></li>
</nav>
<div id="main">
<h1 class="page-title">Player</h1>
<section>
<header>
<h2>
Player
</h2>
</header>
<article>
<div class="container-overview">
<div class="section-method">
<h4 class="name" id="Player"><span class="type-signature"></span>new Player<span class="signature">(client, youtubeToken, 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>client</code></td>
<td class="type">
<span class="param-type"><code>Client</code></span>
</td>
<td class="description last">
<p>Your Discord Client instance.</p>
</td>
</tr>
<tr>
<td class="name"><code>youtubeToken</code></td>
<td class="type">
<span class="param-type"><code>string</code></span>
</td>
<td class="description last">
<p>Your Youtube Data v3 API key.</p>
</td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type"><code><a href="global.html#PlayerOptions">PlayerOptions</a></code></span>
</td>
<td class="description last">
<p>The PlayerOptions object.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<h3 class="subsection-title">Members</h3>
<div class="section-members">
<h4 class="name" id="client"><span class="type-signature"></span>client<span class="type-signature"> :Client</span></h4>
<div class="description">
<p>Your Discord Client instance.</p>
</div>
<dl class="details">
</dl>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><code>Client</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#PlayerOptions">PlayerOptions</a></span></h4>
<div class="description">
<p>Player options.</p>
</div>
<dl class="details">
</dl>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><code><a href="global.html#PlayerOptions">PlayerOptions</a></code></span>
</li>
</ul>
</div>
<div class="section-members">
<h4 class="name" id="queues"><span class="type-signature"></span>queues<span class="type-signature"> :Array.&lt;<a href="Queue.html">Queue</a>></span></h4>
<div class="description">
<p>The guilds data.</p>
</div>
<dl class="details">
</dl>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><code>Array.&lt;<a href="Queue.html">Queue</a>></code></span>
</li>
</ul>
</div>
<div class="section-members">
<h4 class="name" id="SYA"><span class="type-signature"></span>SYA<span class="type-signature"> :Youtube</span></h4>
<div class="description">
<p>The Simple Youtube API Client.</p>
</div>
<dl class="details">
</dl>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><code>Youtube</code></span>
</li>
</ul>
</div>
<div class="section-members">
<h4 class="name" id="youtubeToken"><span class="type-signature"></span>youtubeToken<span class="type-signature"> :string</span></h4>
<div class="description">
<p>Your Youtube Data v3 API key.</p>
</div>
<dl class="details">
</dl>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><code>string</code></span>
</li>
</ul>
</div>
<h3 class="subsection-title">Methods</h3>
<div class="section-method">
<h4 class="name" id="addToQueue"><span class="type-signature"></span>addToQueue<span class="signature">(guildID, songName)</span><span class="type-signature"> &rarr; {Promise.&lt;<a href="Song.html">Song</a>>}</span></h4>
<div class="description">
<p>Adds a song to the guild queue.</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>guildID</code></td>
<td class="type">
<span class="param-type"><code>string</code></span>
</td>
<td class="description last">
</td>
</tr>
<tr>
<td class="name"><code>songName</code></td>
<td class="type">
<span class="param-type"><code>string</code></span>
</td>
<td class="description last">
<p>The name of the song to add to the queue.</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.&lt;<a href="Song.html">Song</a>></code></span>
</dd>
</dl>
</div>
</div>
<div class="section-method">
<h4 class="name" id="clearQueue"><span class="type-signature"></span>clearQueue<span class="signature">(guildID)</span><span class="type-signature"> &rarr; {Promise.&lt;<a href="Queue.html">Queue</a>>}</span></h4>
<div class="description">
<p>Clears the guild queue, but not the current song.</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>guildID</code></td>
<td class="type">
<span class="param-type"><code>string</code></span>
</td>
<td class="description last">
</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.&lt;<a href="Queue.html">Queue</a>></code></span>
</dd>
</dl>
</div>
</div>
<div class="section-method">
<h4 class="name" id="getQueue"><span class="type-signature"></span>getQueue<span class="signature">(guildID)</span><span class="type-signature"> &rarr; (nullable) {<a href="Queue.html">Queue</a>}</span></h4>
<div class="description">
<p>Gets the guild queue.</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>guildID</code></td>
<td class="type">
<span class="param-type"><code>string</code></span>
</td>
<td class="description last">
</td>
</tr>
</tbody>
</table>
<div class="section-returns">
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type:
</dt>
<dd>
<span class="param-type"><code><a href="Queue.html">Queue</a></code></span>
</dd>
</dl>
</div>
</div>
<div class="section-method">
<h4 class="name" id="isPlaying"><span class="type-signature"></span>isPlaying<span class="signature">(guildID)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
<div class="description">
<p>Whether a guild is currently playing songs</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>guildID</code></td>
<td class="type">
<span class="param-type"><code>string</code></span>
</td>
<td class="description last">
<p>The guild ID 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>Boolean</code></span>
</dd>
</dl>
<div class="param-desc">
<p>Whether the guild is currently playing songs</p>
</div>
</div>
</div>
<div class="section-method">
<h4 class="name" id="nowPlaying"><span class="type-signature"></span>nowPlaying<span class="signature">(guildID)</span><span class="type-signature"> &rarr; {Promise.&lt;<a href="Song.html">Song</a>>}</span></h4>
<div class="description">
<p>Gets the currently playing song.</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>guildID</code></td>
<td class="type">
<span class="param-type"><code>string</code></span>
</td>
<td class="description last">
</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.&lt;<a href="Song.html">Song</a>></code></span>
</dd>
</dl>
</div>
</div>
<div class="section-method">
<h4 class="name" id="pause"><span class="type-signature"></span>pause<span class="signature">(guildID)</span><span class="type-signature"> &rarr; {Promise.&lt;<a href="Song.html">Song</a>>}</span></h4>
<div class="description">
<p>Pauses the current song.</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>guildID</code></td>
<td class="type">
<span class="param-type"><code>string</code></span>
</td>
<td class="description last">
</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.&lt;<a href="Song.html">Song</a>></code></span>
</dd>
</dl>
</div>
</div>
<div class="section-method">
<h4 class="name" id="play"><span class="type-signature"></span>play<span class="signature">(voiceChannel, songName)</span><span class="type-signature"> &rarr; {Promise.&lt;<a href="Song.html">Song</a>>}</span></h4>
<div class="description">
<p>Plays a song in a voice channel.</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>voiceChannel</code></td>
<td class="type">
<span class="param-type"><code>voiceChannel</code></span>
</td>
<td class="description last">
<p>The voice channel in which the song will be played.</p>
</td>
</tr>
<tr>
<td class="name"><code>songName</code></td>
<td class="type">
<span class="param-type"><code>string</code></span>
</td>
<td class="description last">
<p>The name of the song to play.</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.&lt;<a href="Song.html">Song</a>></code></span>
</dd>
</dl>
</div>
</div>
<div class="section-method">
<h4 class="name" id="resume"><span class="type-signature"></span>resume<span class="signature">(guildID)</span><span class="type-signature"> &rarr; {Promise.&lt;<a href="Song.html">Song</a>>}</span></h4>
<div class="description">
<p>Resumes the current song.</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>guildID</code></td>
<td class="type">
<span class="param-type"><code>string</code></span>
</td>
<td class="description last">
</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.&lt;<a href="Song.html">Song</a>></code></span>
</dd>
</dl>
</div>
</div>
<div class="section-method">
<h4 class="name" id="setQueue"><span class="type-signature"></span>setQueue<span class="signature">(guildID, songs)</span><span class="type-signature"> &rarr; {Promise.&lt;<a href="Queue.html">Queue</a>>}</span></h4>
<div class="description">
<p>Sets the queue for a guild.</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>guildID</code></td>
<td class="type">
<span class="param-type"><code>string</code></span>
</td>
<td class="description last">
</td>
</tr>
<tr>
<td class="name"><code>songs</code></td>
<td class="type">
<span class="param-type"><code>Array.&lt;<a href="Song.html">Song</a>></code></span>
</td>
<td class="description last">
<p>The songs list</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.&lt;<a href="Queue.html">Queue</a>></code></span>
</dd>
</dl>
</div>
</div>
<div class="section-method">
<h4 class="name" id="setRepeatMode"><span class="type-signature"></span>setRepeatMode<span class="signature">(guildID, enabled)</span><span class="type-signature"> &rarr; {Promise.&lt;Void>}</span></h4>
<div class="description">
<p>Enable or disable the repeat mode</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>guildID</code></td>
<td class="type">
<span class="param-type"><code>string</code></span>
</td>
<td class="description last">
</td>
</tr>
<tr>
<td class="name"><code>enabled</code></td>
<td class="type">
<span class="param-type"><code>Boolean</code></span>
</td>
<td class="description last">
<p>Whether the repeat mode should be enabled</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.&lt;Void></code></span>
</dd>
</dl>
</div>
</div>
<div class="section-method">
<h4 class="name" id="setVolume"><span class="type-signature"></span>setVolume<span class="signature">(guildID, percent)</span><span class="type-signature"> &rarr; {Promise.&lt;void>}</span></h4>
<div class="description">
<p>Updates the volume.</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>guildID</code></td>
<td class="type">
<span class="param-type"><code>string</code></span>
</td>
<td class="description last">
</td>
</tr>
<tr>
<td class="name"><code>percent</code></td>
<td class="type">
<span class="param-type"><code>number</code></span>
</td>
<td class="description last">
</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.&lt;void></code></span>
</dd>
</dl>
</div>
</div>
<div class="section-method">
<h4 class="name" id="skip"><span class="type-signature"></span>skip<span class="signature">(guildID)</span><span class="type-signature"> &rarr; {Promise.&lt;<a href="Song.html">Song</a>>}</span></h4>
<div class="description">
<p>Skips a song.</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>guildID</code></td>
<td class="type">
<span class="param-type"><code>string</code></span>
</td>
<td class="description last">
</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.&lt;<a href="Song.html">Song</a>></code></span>
</dd>
</dl>
</div>
</div>
<div class="section-method">
<h4 class="name" id="stop"><span class="type-signature"></span>stop<span class="signature">(guildID)</span><span class="type-signature"> &rarr; {Promise.&lt;void>}</span></h4>
<div class="description">
<p>Stops playing music.</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>guildID</code></td>
<td class="type">
<span class="param-type"><code>string</code></span>
</td>
<td class="description last">
</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.&lt;void></code></span>
</dd>
</dl>
</div>
</div>
</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>