Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated requester interface type #64

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/assets/search.js

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions docs/classes/Kazagumo.Kazagumo.html

Large diffs are not rendered by default.

62 changes: 31 additions & 31 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.

42 changes: 21 additions & 21 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.

28 changes: 14 additions & 14 deletions docs/interfaces/Kazagumo.KazagumoEvents.html

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions docs/interfaces/Modules_Interfaces.CreatePlayerOptions.html

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions docs/interfaces/Modules_Interfaces.KazagumoOptions.html

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

6 changes: 3 additions & 3 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.

10 changes: 5 additions & 5 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/5f2449b/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/ErrorDoc404/Kazagumo/blob/1160137/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/5f2449b/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/ErrorDoc404/Kazagumo/blob/1160137/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.

16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@
"typescript": "^5.3.3"
},
"dependencies": {
"shoukaku": "^4.1.0"
"shoukaku": "^4.1.1"
}
}
1 change: 1 addition & 0 deletions src/Kazagumo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ export class Kazagumo extends EventEmitter {
player.sendServerUpdate(connection);
};
await player.sendServerUpdate(connection);
// @ts-ignore
connection.on('connectionUpdate', onUpdate);
this.shoukaku.players.set(player.guildId, player);
return player;
Expand Down
1 change: 1 addition & 0 deletions src/Managers/KazagumoPlayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ export class KazagumoPlayer {
this.shoukaku.clean();
await this.kazagumo.shoukaku.leaveVoiceChannel(this.guildId);
await this.shoukaku.destroy();
// @ts-ignore
this.shoukaku.removeAllListeners();
this.kazagumo.players.delete(this.guildId);
this.state = PlayerState.DESTROYED;
Expand Down
9 changes: 5 additions & 4 deletions src/Managers/Supports/KazagumoTrack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
} from '../../Modules/Interfaces';
import { Track } from 'shoukaku';
import { KazagumoPlayer } from '../KazagumoPlayer';
import { User } from 'discord.js';

export class KazagumoTrack {
/**
Expand All @@ -19,7 +20,7 @@ export class KazagumoTrack {
/**
* Track Requester
*/
public requester: unknown | undefined;
public requester?: typeof User | undefined;

/** Track's Base64 */
public track: string;
Expand Down Expand Up @@ -50,7 +51,7 @@ export class KazagumoTrack {

constructor(
private readonly raw: Track,
requester: unknown,
requester?: typeof User,
) {
this.kazagumo = undefined;

Expand Down Expand Up @@ -182,8 +183,8 @@ export class KazagumoTrack {
if (!node) throw new KazagumoError(1, 'No nodes available');

const result = player
? await player.search(query, { source, requester: this.requester })
: await this.kazagumo.search(query, { engine: defaultSearchEngine, requester: this.requester });
? await player.search(query, { source, requester: this.requester as typeof User })
: await this.kazagumo.search(query, { engine: defaultSearchEngine, requester: this.requester as typeof User });
if (!result || !result.tracks.length) throw new KazagumoError(2, 'No results found');

const rawTracks = result.tracks.map((x) => x.getRaw()._raw);
Expand Down
4 changes: 3 additions & 1 deletion src/Modules/Interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { KazagumoPlayer, KazagumoQueue } from '../Index';
import { KazagumoTrack } from '../Managers/Supports/KazagumoTrack';
import { Constructor } from './Utils';
import { Track } from 'shoukaku';
import { User } from 'discord.js';

export interface KazagumoOptions {
/** Default search engine if no engine was provided. Default to youtube. If defaultSource is provided, this will be ignored */
Expand Down Expand Up @@ -135,7 +136,7 @@ export interface PlayerMovedChannels {
export type PlayerMovedState = 'UNKNOWN' | 'JOINED' | 'LEFT' | 'MOVED';

export interface KazagumoSearchOptions {
requester: unknown;
requester?: typeof User;
source?: string;
engine?: SearchEngines;
nodeName?: string;
Expand Down Expand Up @@ -169,6 +170,7 @@ export interface PlayOptions {
endTime?: number;
volume?: number;
paused?: boolean;
replaceCurrent?: boolean;
}

export enum State {
Expand Down