ziplayer 0.2.7 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AI-Guide.md +624 -956
- package/README.md +277 -10
- package/dist/extensions/BaseExtension.d.ts +1 -0
- package/dist/extensions/BaseExtension.d.ts.map +1 -1
- package/dist/extensions/BaseExtension.js.map +1 -1
- package/dist/extensions/index.d.ts +38 -3
- package/dist/extensions/index.d.ts.map +1 -1
- package/dist/extensions/index.js +259 -41
- package/dist/extensions/index.js.map +1 -1
- package/dist/persistence/PersistenceManager.d.ts +95 -0
- package/dist/persistence/PersistenceManager.d.ts.map +1 -0
- package/dist/persistence/PersistenceManager.js +975 -0
- package/dist/persistence/PersistenceManager.js.map +1 -0
- package/dist/plugins/BasePlugin.js +1 -1
- package/dist/plugins/BasePlugin.js.map +1 -1
- package/dist/plugins/index.d.ts +73 -8
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +647 -116
- package/dist/plugins/index.js.map +1 -1
- package/dist/structures/FilterManager.js +3 -3
- package/dist/structures/FilterManager.js.map +1 -1
- package/dist/structures/PersistenceManager.d.ts +96 -0
- package/dist/structures/PersistenceManager.d.ts.map +1 -0
- package/dist/structures/PersistenceManager.js +1008 -0
- package/dist/structures/PersistenceManager.js.map +1 -0
- package/dist/structures/Player.d.ts +157 -14
- package/dist/structures/Player.d.ts.map +1 -1
- package/dist/structures/Player.js +1163 -188
- package/dist/structures/Player.js.map +1 -1
- package/dist/structures/PlayerManager.d.ts +106 -91
- package/dist/structures/PlayerManager.d.ts.map +1 -1
- package/dist/structures/PlayerManager.js +365 -124
- package/dist/structures/PlayerManager.js.map +1 -1
- package/dist/structures/Queue.d.ts +136 -31
- package/dist/structures/Queue.d.ts.map +1 -1
- package/dist/structures/Queue.js +265 -46
- package/dist/structures/Queue.js.map +1 -1
- package/dist/structures/StreamManager.d.ts +137 -0
- package/dist/structures/StreamManager.d.ts.map +1 -0
- package/dist/structures/StreamManager.js +420 -0
- package/dist/structures/StreamManager.js.map +1 -0
- package/dist/types/index.d.ts +181 -8
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/persistence.d.ts +77 -0
- package/dist/types/persistence.d.ts.map +1 -0
- package/dist/types/persistence.js +3 -0
- package/dist/types/persistence.js.map +1 -0
- package/package.json +3 -2
- package/src/extensions/BaseExtension.ts +1 -0
- package/src/extensions/index.ts +320 -37
- package/src/plugins/BasePlugin.ts +1 -1
- package/src/plugins/index.ts +801 -139
- package/src/structures/FilterManager.ts +3 -3
- package/src/structures/Player.ts +2797 -1693
- package/src/structures/PlayerManager.ts +438 -129
- package/src/structures/Queue.ts +300 -55
- package/src/structures/StreamManager.ts +524 -0
- package/src/types/extension.ts +129 -129
- package/src/types/fillter.ts +264 -264
- package/src/types/index.ts +187 -12
- package/src/types/plugin.ts +59 -59
- package/tsconfig.json +0 -1
package/src/types/extension.ts
CHANGED
|
@@ -1,129 +1,129 @@
|
|
|
1
|
-
import type { VoiceConnection } from "@discordjs/voice";
|
|
2
|
-
import type { Player } from "../structures/Player";
|
|
3
|
-
import type { PlayerManager } from "../structures/PlayerManager";
|
|
4
|
-
import type { Track, SearchResult, StreamInfo } from ".";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Extension interface
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* const extension: SourceExtension = {
|
|
11
|
-
* name: "YouTube",
|
|
12
|
-
* version: "1.0.0"
|
|
13
|
-
* };
|
|
14
|
-
*/
|
|
15
|
-
export interface SourceExtension {
|
|
16
|
-
name: string;
|
|
17
|
-
version: string;
|
|
18
|
-
connection?: VoiceConnection;
|
|
19
|
-
player: Player | null;
|
|
20
|
-
active(alas: any): boolean | Promise<boolean>;
|
|
21
|
-
onRegister?(context: ExtensionContext): void | Promise<void>;
|
|
22
|
-
onDestroy?(context: ExtensionContext): void | Promise<void>;
|
|
23
|
-
beforePlay?(
|
|
24
|
-
context: ExtensionContext,
|
|
25
|
-
payload: ExtensionPlayRequest,
|
|
26
|
-
): Promise<ExtensionPlayResponse | void> | ExtensionPlayResponse | void;
|
|
27
|
-
afterPlay?(context: ExtensionContext, payload: ExtensionAfterPlayPayload): Promise<void> | void;
|
|
28
|
-
provideSearch?(
|
|
29
|
-
context: ExtensionContext,
|
|
30
|
-
payload: ExtensionSearchRequest,
|
|
31
|
-
): Promise<SearchResult | null | undefined> | SearchResult | null | undefined;
|
|
32
|
-
provideStream?(
|
|
33
|
-
context: ExtensionContext,
|
|
34
|
-
payload: ExtensionStreamRequest,
|
|
35
|
-
): Promise<StreamInfo | null | undefined> | StreamInfo | null | undefined;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Context for the extension
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* const context: ExtensionContext = {
|
|
43
|
-
* player: player,
|
|
44
|
-
* manager: manager
|
|
45
|
-
* };
|
|
46
|
-
*/
|
|
47
|
-
export interface ExtensionContext {
|
|
48
|
-
player: Player;
|
|
49
|
-
manager: PlayerManager;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Request for the extension to play a track
|
|
54
|
-
*
|
|
55
|
-
* @example
|
|
56
|
-
* const request: ExtensionPlayRequest = {
|
|
57
|
-
* query: "Song Name",
|
|
58
|
-
* requestedBy: "user123"
|
|
59
|
-
* };
|
|
60
|
-
*/
|
|
61
|
-
export interface ExtensionPlayRequest {
|
|
62
|
-
query: string | Track;
|
|
63
|
-
requestedBy?: string;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Response for the extension to play a track
|
|
68
|
-
*
|
|
69
|
-
* @example
|
|
70
|
-
* const response: ExtensionPlayResponse = {
|
|
71
|
-
* handled: true,
|
|
72
|
-
* query: "Song Name",
|
|
73
|
-
* requestedBy: "user123"
|
|
74
|
-
* };
|
|
75
|
-
*/
|
|
76
|
-
export interface ExtensionPlayResponse {
|
|
77
|
-
handled?: boolean;
|
|
78
|
-
query?: string | Track;
|
|
79
|
-
requestedBy?: string;
|
|
80
|
-
tracks?: Track[];
|
|
81
|
-
isPlaylist?: boolean;
|
|
82
|
-
success?: boolean;
|
|
83
|
-
error?: Error;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Payload for the extension to play a track
|
|
88
|
-
*
|
|
89
|
-
* @example
|
|
90
|
-
* const payload: ExtensionAfterPlayPayload = {
|
|
91
|
-
* success: true,
|
|
92
|
-
* query: "Song Name",
|
|
93
|
-
* requestedBy: "user123"
|
|
94
|
-
* };
|
|
95
|
-
*/
|
|
96
|
-
export interface ExtensionAfterPlayPayload {
|
|
97
|
-
success: boolean;
|
|
98
|
-
query: string | Track;
|
|
99
|
-
requestedBy?: string;
|
|
100
|
-
tracks?: Track[];
|
|
101
|
-
isPlaylist?: boolean;
|
|
102
|
-
error?: Error;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Request for the extension to stream a track
|
|
107
|
-
*
|
|
108
|
-
* @example
|
|
109
|
-
* const request: ExtensionStreamRequest = {
|
|
110
|
-
* track: track
|
|
111
|
-
* };
|
|
112
|
-
*/
|
|
113
|
-
export interface ExtensionStreamRequest {
|
|
114
|
-
track: Track;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Request for the extension to search for a track
|
|
119
|
-
*
|
|
120
|
-
* @example
|
|
121
|
-
* const request: ExtensionSearchRequest = {
|
|
122
|
-
* query: "Song Name",
|
|
123
|
-
* requestedBy: "user123"
|
|
124
|
-
* };
|
|
125
|
-
*/
|
|
126
|
-
export interface ExtensionSearchRequest {
|
|
127
|
-
query: string;
|
|
128
|
-
requestedBy: string;
|
|
129
|
-
}
|
|
1
|
+
import type { VoiceConnection } from "@discordjs/voice";
|
|
2
|
+
import type { Player } from "../structures/Player";
|
|
3
|
+
import type { PlayerManager } from "../structures/PlayerManager";
|
|
4
|
+
import type { Track, SearchResult, StreamInfo } from ".";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Extension interface
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const extension: SourceExtension = {
|
|
11
|
+
* name: "YouTube",
|
|
12
|
+
* version: "1.0.0"
|
|
13
|
+
* };
|
|
14
|
+
*/
|
|
15
|
+
export interface SourceExtension {
|
|
16
|
+
name: string;
|
|
17
|
+
version: string;
|
|
18
|
+
connection?: VoiceConnection;
|
|
19
|
+
player: Player | null;
|
|
20
|
+
active(alas: any): boolean | Promise<boolean>;
|
|
21
|
+
onRegister?(context: ExtensionContext): void | Promise<void>;
|
|
22
|
+
onDestroy?(context: ExtensionContext): void | Promise<void>;
|
|
23
|
+
beforePlay?(
|
|
24
|
+
context: ExtensionContext,
|
|
25
|
+
payload: ExtensionPlayRequest,
|
|
26
|
+
): Promise<ExtensionPlayResponse | void> | ExtensionPlayResponse | void;
|
|
27
|
+
afterPlay?(context: ExtensionContext, payload: ExtensionAfterPlayPayload): Promise<void> | void;
|
|
28
|
+
provideSearch?(
|
|
29
|
+
context: ExtensionContext,
|
|
30
|
+
payload: ExtensionSearchRequest,
|
|
31
|
+
): Promise<SearchResult | null | undefined> | SearchResult | null | undefined;
|
|
32
|
+
provideStream?(
|
|
33
|
+
context: ExtensionContext,
|
|
34
|
+
payload: ExtensionStreamRequest,
|
|
35
|
+
): Promise<StreamInfo | null | undefined> | StreamInfo | null | undefined;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Context for the extension
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* const context: ExtensionContext = {
|
|
43
|
+
* player: player,
|
|
44
|
+
* manager: manager
|
|
45
|
+
* };
|
|
46
|
+
*/
|
|
47
|
+
export interface ExtensionContext {
|
|
48
|
+
player: Player;
|
|
49
|
+
manager: PlayerManager;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Request for the extension to play a track
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* const request: ExtensionPlayRequest = {
|
|
57
|
+
* query: "Song Name",
|
|
58
|
+
* requestedBy: "user123"
|
|
59
|
+
* };
|
|
60
|
+
*/
|
|
61
|
+
export interface ExtensionPlayRequest {
|
|
62
|
+
query: string | Track;
|
|
63
|
+
requestedBy?: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Response for the extension to play a track
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* const response: ExtensionPlayResponse = {
|
|
71
|
+
* handled: true,
|
|
72
|
+
* query: "Song Name",
|
|
73
|
+
* requestedBy: "user123"
|
|
74
|
+
* };
|
|
75
|
+
*/
|
|
76
|
+
export interface ExtensionPlayResponse {
|
|
77
|
+
handled?: boolean;
|
|
78
|
+
query?: string | Track;
|
|
79
|
+
requestedBy?: string;
|
|
80
|
+
tracks?: Track[];
|
|
81
|
+
isPlaylist?: boolean;
|
|
82
|
+
success?: boolean;
|
|
83
|
+
error?: Error;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Payload for the extension to play a track
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* const payload: ExtensionAfterPlayPayload = {
|
|
91
|
+
* success: true,
|
|
92
|
+
* query: "Song Name",
|
|
93
|
+
* requestedBy: "user123"
|
|
94
|
+
* };
|
|
95
|
+
*/
|
|
96
|
+
export interface ExtensionAfterPlayPayload {
|
|
97
|
+
success: boolean;
|
|
98
|
+
query: string | Track;
|
|
99
|
+
requestedBy?: string;
|
|
100
|
+
tracks?: Track[];
|
|
101
|
+
isPlaylist?: boolean;
|
|
102
|
+
error?: Error;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Request for the extension to stream a track
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* const request: ExtensionStreamRequest = {
|
|
110
|
+
* track: track
|
|
111
|
+
* };
|
|
112
|
+
*/
|
|
113
|
+
export interface ExtensionStreamRequest {
|
|
114
|
+
track: Track;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Request for the extension to search for a track
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* const request: ExtensionSearchRequest = {
|
|
122
|
+
* query: "Song Name",
|
|
123
|
+
* requestedBy: "user123"
|
|
124
|
+
* };
|
|
125
|
+
*/
|
|
126
|
+
export interface ExtensionSearchRequest {
|
|
127
|
+
query: string;
|
|
128
|
+
requestedBy: string;
|
|
129
|
+
}
|