Skip to content

Commit

Permalink
Merge pull request #48 from Takiyo0/next-update-3.0.2
Browse files Browse the repository at this point in the history
3.0.2
  • Loading branch information
Takiyo0 authored Mar 24, 2024
2 parents 5fde0f3 + 1187d89 commit b905779
Show file tree
Hide file tree
Showing 50 changed files with 313 additions and 265 deletions.
176 changes: 106 additions & 70 deletions .idea/workspace.xml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ Pls read the docs before asking 🙏🙏🙏 There is a useful search feature th
## Metadata

> version: 3.0.0
> version: 3.0.2
> pre-release: false
> Last build: 7-1-2024 5.36 PM
> Last build: 3-24-2024 21.36 PM
## Plugins
- Official [spotify plugin](https://npmjs.com/package/kazagumo-spotify)
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/search.js

Large diffs are not rendered by default.

52 changes: 26 additions & 26 deletions docs/classes/Kazagumo.Kazagumo.html

Large diffs are not rendered by default.

64 changes: 32 additions & 32 deletions docs/classes/Managers_KazagumoPlayer.KazagumoPlayer.html

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions docs/classes/Managers_Supports_KazagumoQueue.KazagumoQueue.html

Large diffs are not rendered by default.

40 changes: 20 additions & 20 deletions docs/classes/Managers_Supports_KazagumoTrack.KazagumoTrack.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/classes/Modules_Interfaces.KazagumoError.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/classes/Modules_Interfaces.KazagumoPlugin.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/classes/Modules_Utils.KazagumoUtils.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions docs/classes/Plugins_PlayerMoved.KazagumoPlugin.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/enums/Modules_Interfaces.PlayerState.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/enums/Modules_Interfaces.State.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/enums/Modules_Interfaces.VoiceState.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/functions/Modules_Interfaces.escapeRegExp.html

Large diffs are not rendered by default.

20 changes: 7 additions & 13 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,30 @@
<p>npm i kazagumo</p>
</blockquote>
<a id="md:metadata" class="tsd-anchor"></a><h2><a href="#md:metadata">Metadata</a></h2><blockquote>
<p>version: 3.0.0<br>pre-release: false<br>Last build: 7-1-2024 5.36 PM</p>
<p>version: 3.0.2<br>pre-release: false<br>Last build: 3-24-2024 21.36 PM</p>
</blockquote>
<a id="md:plugins" class="tsd-anchor"></a><h2><a href="#md:plugins">Plugins</a></h2><ul>
<li><p>Official <a href="https://npmjs.com/package/kazagumo-spotify">spotify plugin</a></p>
<blockquote>
<li>Official <a href="https://npmjs.com/package/kazagumo-spotify">spotify plugin</a><blockquote>
<p>npm i kazagumo-spotify</p>
</blockquote>
</li>
<li><p>Additional <a href="https://www.npmjs.com/package/kazagumo-apple">apple plugin</a></p>
<blockquote>
<li>Additional <a href="https://www.npmjs.com/package/kazagumo-apple">apple plugin</a><blockquote>
<p>npm i kazagumo-apple</p>
</blockquote>
</li>
<li><p>Additional <a href="https://www.npmjs.com/package/kazagumo-apple">filter plugin</a> (v2.3.x only, v2.4.x not tested)</p>
<blockquote>
<li>Additional <a href="https://www.npmjs.com/package/kazagumo-filter">filter plugin</a><blockquote>
<p>npm i kazagumo-filter</p>
</blockquote>
</li>
<li><p>Additional <a href="https://www.npmjs.com/package/kazagumo-nico">nicovideo.jp plugin</a> (v2.3.x only, v2.4.x not tested)</p>
<blockquote>
<li>Additional <a href="https://www.npmjs.com/package/kazagumo-nico">nicovideo.jp plugin</a><blockquote>
<p>npm i kazagumo-nico</p>
</blockquote>
</li>
<li><p>Additional <a href="https://www.npmjs.com/package/kazagumo-deezer">deezer plugin</a> (v2.3.x only, v2.4.x not tested)</p>
<blockquote>
<li>Additional <a href="https://www.npmjs.com/package/kazagumo-deezer">deezer plugin</a><blockquote>
<p>npm i kazagumo-deezer</p>
</blockquote>
</li>
<li><p>Stone-Deezer <a href="https://www.npmjs.com/package/stone-deezer">deezer plugin</a></p>
<blockquote>
<li>Stone-Deezer <a href="https://www.npmjs.com/package/stone-deezer">deezer plugin</a><blockquote>
<p>npm i stone-deezer</p>
</blockquote>
</li>
Expand Down
22 changes: 11 additions & 11 deletions docs/interfaces/Modules_Interfaces.CreatePlayerOptions.html

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions docs/interfaces/Modules_Interfaces.KazagumoOptions.html

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions docs/interfaces/Modules_Interfaces.KazagumoPlayerOptions.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/interfaces/Modules_Interfaces.KazagumoSearchOptions.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/interfaces/Modules_Interfaces.KazagumoSearchResult.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/interfaces/Modules_Interfaces.Payload.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/interfaces/Modules_Interfaces.PlayOptions.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/interfaces/Modules_Interfaces.PlayerMovedChannels.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/interfaces/Modules_Interfaces.RawTrack.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/interfaces/Modules_Interfaces.ResolveOptions.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/modules/Index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>Index | kazagumo</title><meta name="description" content="Documentation for kazagumo"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">kazagumo</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">kazagumo</a></li><li><a href="Index.html">Index</a></li></ul><h1>Module Index</h1></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/Takiyo0/Kazagumo/blob/d301a73/src/Index.ts#L1">src/Index.ts:1</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">References</h3><div class="tsd-index-list"><a href="Index.html#CreatePlayerOptions" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-4194304"></use></svg><span>Create<wbr/>Player<wbr/>Options</span></a>
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>Index | kazagumo</title><meta name="description" content="Documentation for kazagumo"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">kazagumo</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">kazagumo</a></li><li><a href="Index.html">Index</a></li></ul><h1>Module Index</h1></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/Takiyo0/Kazagumo/blob/9957bff/src/Index.ts#L1">src/Index.ts:1</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">References</h3><div class="tsd-index-list"><a href="Index.html#CreatePlayerOptions" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-4194304"></use></svg><span>Create<wbr/>Player<wbr/>Options</span></a>
<a href="Index.html#Events" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-4194304"></use></svg><span>Events</span></a>
<a href="Index.html#Kazagumo" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-4194304"></use></svg><span>Kazagumo</span></a>
<a href="Index.html#KazagumoError" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-4194304"></use></svg><span>Kazagumo<wbr/>Error</span></a>
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/Kazagumo.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/modules/Managers_KazagumoPlayer.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/modules/Managers_Supports_KazagumoQueue.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/modules/Managers_Supports_KazagumoTrack.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/modules/Modules_Interfaces.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>Modules/Interfaces | kazagumo</title><meta name="description" content="Documentation for kazagumo"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">kazagumo</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">kazagumo</a></li><li><a href="Modules_Interfaces.html">Modules/Interfaces</a></li></ul><h1>Module Modules/Interfaces</h1></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/Takiyo0/Kazagumo/blob/d301a73/src/Modules/Interfaces.ts#L1">src/Modules/Interfaces.ts:1</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><h3 class="tsd-index-heading uppercase">Index</h3><section class="tsd-index-section"><h3 class="tsd-index-heading">Enumerations</h3><div class="tsd-index-list"><a href="../enums/Modules_Interfaces.PlayerState.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-8"></use></svg><span>Player<wbr/>State</span></a>
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>Modules/Interfaces | kazagumo</title><meta name="description" content="Documentation for kazagumo"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">kazagumo</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">kazagumo</a></li><li><a href="Modules_Interfaces.html">Modules/Interfaces</a></li></ul><h1>Module Modules/Interfaces</h1></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/Takiyo0/Kazagumo/blob/9957bff/src/Modules/Interfaces.ts#L1">src/Modules/Interfaces.ts:1</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><h3 class="tsd-index-heading uppercase">Index</h3><section class="tsd-index-section"><h3 class="tsd-index-heading">Enumerations</h3><div class="tsd-index-list"><a href="../enums/Modules_Interfaces.PlayerState.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-8"></use></svg><span>Player<wbr/>State</span></a>
<a href="../enums/Modules_Interfaces.State.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-8"></use></svg><span>State</span></a>
<a href="../enums/Modules_Interfaces.VoiceState.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-8"></use></svg><span>Voice<wbr/>State</span></a>
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Classes</h3><div class="tsd-index-list"><a href="../classes/Modules_Interfaces.KazagumoError.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg><span>Kazagumo<wbr/>Error</span></a>
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/Modules_Plugins.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/modules/Modules_Utils.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/modules/Plugins_PlayerMoved.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/types/Modules_Interfaces.PlayerMovedState.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/types/Modules_Interfaces.SearchEngines.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/types/Modules_Interfaces.SearchResultTypes.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/types/Modules_Interfaces.YoutubeThumbnail.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/types/Modules_Utils.Constructor.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/variables/Index.version.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/variables/Modules_Interfaces.Events.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/variables/Modules_Interfaces.SourceIDs.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/variables/Modules_Interfaces.SupportedSources.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/variables/Modules_Plugins.default.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kazagumo",
"version": "3.0.0",
"version": "3.0.2",
"description": "A shoukaku wrapper with built-in queue support.",
"main": "dist/Index.js",
"types": "dist/Index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/Index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ export * from './Kazagumo';
export { KazagumoTrack, KazagumoQueue, KazagumoPlayer, Plugins };
export * from './Modules/Interfaces';

export const version = '2.2.3';
export const version = '3.0.2';
5 changes: 4 additions & 1 deletion src/Kazagumo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,10 @@ export class Kazagumo extends EventEmitter {
!this.shoukaku.players.has(newPlayerOptions.guildId)
) {
this.shoukaku.connections.get(newPlayerOptions.guildId)!.disconnect();
throw new KazagumoError(4, 'Connection exist but player not found. Destroying connection...');
// tslint:disable-next-line:no-console
console.log(
'[KazagumoError; l220 Kazagumo.ts] -> Connection exist but player not found. Destroying connection...',
);
}

const connection = new Connection(this.shoukaku, newPlayerOptions);
Expand Down
29 changes: 20 additions & 9 deletions src/Managers/KazagumoPlayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ export class KazagumoPlayer {
* Search track/s
*/
public search: (query: string, options?: KazagumoSearchOptions) => Promise<KazagumoSearchResult>;
/**
* Player's volume in percentage (default 100%)
*/
public volume: number = 100;
/**
* Player's custom data
*/
Expand All @@ -94,7 +98,7 @@ export class KazagumoPlayer {
this.guildId = options.guildId;
this.voiceId = options.voiceId;
this.textId = options.textId;
this.queue = new KazagumoQueue(this);
this.queue = new (this.options.extends?.queue ?? KazagumoQueue)(this);

if (options.volume !== 100) this.setVolume(options.volume);

Expand Down Expand Up @@ -154,12 +158,12 @@ export class KazagumoPlayer {
this.shoukaku.on('resumed', () => this.emit(Events.PlayerResumed, this));
}

/**
* Get volume
*/
public get volume(): number {
return this.shoukaku.filters.volume || 1;
}
// /**
// * Get volume
// */
// public get volume(): number {
// return this.shoukaku.filters.volume || 1;
// }

/**
* Get player position
Expand Down Expand Up @@ -347,15 +351,22 @@ export class KazagumoPlayer {
}

/**
* Set the volume
* Set the volume in percentage (default 100%)
* @param volume Volume
* @returns KazagumoPlayer
*/
public async setVolume(volume: number): Promise<KazagumoPlayer> {
if (this.state === PlayerState.DESTROYED) throw new KazagumoError(1, 'Player is already destroyed');
if (isNaN(volume)) throw new KazagumoError(1, 'volume must be a number');

await this.shoukaku.setFilterVolume(volume / 100);
await this.node.rest.updatePlayer({
guildId: this.guildId,
playerOptions: {
volume,
},
});

this.volume = volume;

return this;
}
Expand Down
5 changes: 4 additions & 1 deletion src/Modules/Interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Kazagumo } from '../Kazagumo';
import { KazagumoPlayer } from '../Index';
import { KazagumoPlayer, KazagumoQueue } from '../Index';
import { KazagumoTrack } from '../Managers/Supports/KazagumoTrack';
import { Constructor } from './Utils';
import { Snowflake } from 'discord.js';
Expand Down Expand Up @@ -54,6 +54,9 @@ export interface KazagumoPlayerOptions {
volume: number;
/** Whether the node for searching track should be the same as the node for playing track. Default: true */
searchWithSameNode?: boolean;
extends?: {
queue?: Constructor<KazagumoQueue>;
};
}

export interface ResolveOptions {
Expand Down

0 comments on commit b905779

Please sign in to comment.