lavalink-client 2.3.5 → 2.4.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/README.md +73 -6
- package/dist/cjs/structures/Constants.d.ts +4 -0
- package/dist/cjs/structures/Constants.js +7 -2
- package/dist/cjs/structures/Filters.d.ts +24 -0
- package/dist/cjs/structures/Filters.js +34 -10
- package/dist/cjs/structures/LavalinkManager.d.ts +4 -5
- package/dist/cjs/structures/LavalinkManager.js +36 -14
- package/dist/cjs/structures/LavalinkManagerStatics.d.ts +2 -0
- package/dist/cjs/structures/LavalinkManagerStatics.js +11 -2
- package/dist/cjs/structures/Node.d.ts +107 -13
- package/dist/cjs/structures/Node.js +294 -76
- package/dist/cjs/structures/NodeManager.d.ts +2 -2
- package/dist/cjs/structures/NodeManager.js +19 -19
- package/dist/cjs/structures/Player.d.ts +51 -1
- package/dist/cjs/structures/Player.js +62 -0
- package/dist/cjs/structures/Queue.d.ts +9 -10
- package/dist/cjs/structures/Queue.js +3 -3
- package/dist/cjs/structures/Types/Manager.d.ts +59 -1
- package/dist/cjs/structures/Types/Node.d.ts +23 -1
- package/dist/cjs/structures/Types/Player.d.ts +5 -1
- package/dist/cjs/structures/Types/Queue.d.ts +6 -6
- package/dist/cjs/structures/Types/Track.d.ts +3 -1
- package/dist/cjs/structures/Types/Utils.d.ts +81 -8
- package/dist/cjs/structures/Utils.js +11 -9
- package/dist/esm/structures/Constants.d.ts +4 -0
- package/dist/esm/structures/Constants.js +6 -1
- package/dist/esm/structures/Filters.d.ts +24 -0
- package/dist/esm/structures/Filters.js +34 -10
- package/dist/esm/structures/LavalinkManager.d.ts +4 -5
- package/dist/esm/structures/LavalinkManager.js +36 -14
- package/dist/esm/structures/LavalinkManagerStatics.d.ts +2 -0
- package/dist/esm/structures/LavalinkManagerStatics.js +11 -2
- package/dist/esm/structures/Node.d.ts +107 -13
- package/dist/esm/structures/Node.js +294 -76
- package/dist/esm/structures/NodeManager.d.ts +2 -2
- package/dist/esm/structures/NodeManager.js +20 -20
- package/dist/esm/structures/Player.d.ts +51 -1
- package/dist/esm/structures/Player.js +62 -0
- package/dist/esm/structures/Queue.d.ts +9 -10
- package/dist/esm/structures/Queue.js +3 -3
- package/dist/esm/structures/Types/Manager.d.ts +59 -1
- package/dist/esm/structures/Types/Node.d.ts +23 -1
- package/dist/esm/structures/Types/Player.d.ts +5 -1
- package/dist/esm/structures/Types/Queue.d.ts +6 -6
- package/dist/esm/structures/Types/Track.d.ts +3 -1
- package/dist/esm/structures/Types/Utils.d.ts +81 -8
- package/dist/esm/structures/Utils.js +8 -6
- package/dist/types/structures/Constants.d.ts +4 -0
- package/dist/types/structures/Filters.d.ts +24 -0
- package/dist/types/structures/LavalinkManager.d.ts +4 -5
- package/dist/types/structures/LavalinkManagerStatics.d.ts +2 -0
- package/dist/types/structures/Node.d.ts +107 -13
- package/dist/types/structures/NodeManager.d.ts +2 -2
- package/dist/types/structures/Player.d.ts +51 -1
- package/dist/types/structures/Queue.d.ts +9 -10
- package/dist/types/structures/Types/Manager.d.ts +59 -1
- package/dist/types/structures/Types/Node.d.ts +23 -1
- package/dist/types/structures/Types/Player.d.ts +5 -1
- package/dist/types/structures/Types/Queue.d.ts +6 -6
- package/dist/types/structures/Types/Track.d.ts +3 -1
- package/dist/types/structures/Types/Utils.d.ts +81 -8
- package/package.json +29 -18
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { MiniMap } from "./Utils";
|
|
2
1
|
import type { Track, UnresolvedTrack } from "./Types/Track";
|
|
3
2
|
import type { ManagerQueueOptions, QueueStoreManager, StoredQueue } from "./Types/Queue";
|
|
4
3
|
export declare class QueueSaver {
|
|
@@ -24,14 +23,14 @@ export declare class QueueSaver {
|
|
|
24
23
|
* @param guildId The guild ID
|
|
25
24
|
* @returns The queue for the guild
|
|
26
25
|
*/
|
|
27
|
-
delete(guildId: string): Promise<
|
|
26
|
+
delete(guildId: string): Promise<boolean | void>;
|
|
28
27
|
/**
|
|
29
28
|
* Set the queue for a guild
|
|
30
29
|
* @param guildId The guild ID
|
|
31
30
|
* @param valueToStringify The queue to set
|
|
32
31
|
* @returns The queue for the guild
|
|
33
32
|
*/
|
|
34
|
-
set(guildId: string, valueToStringify: StoredQueue): Promise<
|
|
33
|
+
set(guildId: string, valueToStringify: StoredQueue): Promise<boolean | void>;
|
|
35
34
|
/**
|
|
36
35
|
* Sync the queue for a guild
|
|
37
36
|
* @param guildId The guild ID
|
|
@@ -47,32 +46,32 @@ export declare class DefaultQueueStore implements QueueStoreManager {
|
|
|
47
46
|
* @param guildId The guild ID
|
|
48
47
|
* @returns The queue for the guild
|
|
49
48
|
*/
|
|
50
|
-
get(guildId:
|
|
49
|
+
get(guildId: string): Promise<StoredQueue>;
|
|
51
50
|
/**
|
|
52
51
|
* Set the queue for a guild
|
|
53
52
|
* @param guildId The guild ID
|
|
54
53
|
* @param valueToStringify The queue to set
|
|
55
54
|
* @returns The queue for the guild
|
|
56
55
|
*/
|
|
57
|
-
set(guildId:
|
|
56
|
+
set(guildId: string, valueToStringify: any): Promise<boolean>;
|
|
58
57
|
/**
|
|
59
58
|
* Delete the queue for a guild
|
|
60
59
|
* @param guildId The guild ID
|
|
61
60
|
* @returns The queue for the guild
|
|
62
61
|
*/
|
|
63
|
-
delete(guildId:
|
|
62
|
+
delete(guildId: string): Promise<boolean>;
|
|
64
63
|
/**
|
|
65
64
|
* Stringify the queue for a guild
|
|
66
65
|
* @param value The queue to stringify
|
|
67
66
|
* @returns The stringified queue
|
|
68
67
|
*/
|
|
69
|
-
stringify(value:
|
|
68
|
+
stringify(value: StoredQueue): Promise<StoredQueue>;
|
|
70
69
|
/**
|
|
71
70
|
* Parse the queue for a guild
|
|
72
71
|
* @param value The queue to parse
|
|
73
72
|
* @returns The parsed queue
|
|
74
73
|
*/
|
|
75
|
-
parse(value:
|
|
74
|
+
parse(value: StoredQueue): Promise<StoredQueue>;
|
|
76
75
|
}
|
|
77
76
|
export declare class Queue {
|
|
78
77
|
readonly tracks: (Track | UnresolvedTrack)[];
|
|
@@ -100,13 +99,13 @@ export declare class Queue {
|
|
|
100
99
|
/**
|
|
101
100
|
* Save the current cached Queue on the database/server (overides the server)
|
|
102
101
|
*/
|
|
103
|
-
save: () => Promise<
|
|
102
|
+
save: () => Promise<boolean | void>;
|
|
104
103
|
/**
|
|
105
104
|
* Sync the current queue database/server with the cached one
|
|
106
105
|
* @returns {void}
|
|
107
106
|
*/
|
|
108
107
|
sync: (override?: boolean, dontSyncCurrent?: boolean) => Promise<void>;
|
|
109
|
-
destroy: () => Promise<
|
|
108
|
+
destroy: () => Promise<boolean | void>;
|
|
110
109
|
/**
|
|
111
110
|
* @returns {{current:Track|null, previous:Track[], tracks:Track[]}}The Queue, but in a raw State, which allows easier handling for the QueueStoreManager
|
|
112
111
|
*/
|
|
@@ -4,7 +4,7 @@ import type { LavalinkNodeOptions } from "./Node";
|
|
|
4
4
|
import type { DestroyReasonsType, PlayerJson } from "./Player";
|
|
5
5
|
import type { ManagerQueueOptions } from "./Queue";
|
|
6
6
|
import type { Track, UnresolvedTrack } from "./Track";
|
|
7
|
-
import type { GuildShardPayload, SearchPlatform, SponsorBlockChaptersLoaded, SponsorBlockChapterStarted, SponsorBlockSegmentSkipped, SponsorBlockSegmentsLoaded, TrackExceptionEvent, TrackEndEvent, TrackStuckEvent, WebSocketClosedEvent, TrackStartEvent } from "./Utils";
|
|
7
|
+
import type { GuildShardPayload, SearchPlatform, SponsorBlockChaptersLoaded, SponsorBlockChapterStarted, SponsorBlockSegmentSkipped, SponsorBlockSegmentsLoaded, TrackExceptionEvent, TrackEndEvent, TrackStuckEvent, WebSocketClosedEvent, TrackStartEvent, LyricsFoundEvent, LyricsNotFoundEvent, LyricsLineEvent } from "./Utils";
|
|
8
8
|
/**
|
|
9
9
|
* The events from the lavalink Manager
|
|
10
10
|
*/
|
|
@@ -73,6 +73,46 @@ export interface LavalinkManagerEvents {
|
|
|
73
73
|
* @event Manager#playerUpdate
|
|
74
74
|
*/
|
|
75
75
|
"playerUpdate": (oldPlayerJson: PlayerJson, newPlayer: Player) => void;
|
|
76
|
+
/**
|
|
77
|
+
* Emitted when the player's selfMuted or serverMuted state changed (true -> false | false -> true)
|
|
78
|
+
* @event Manager#playerMuteChange
|
|
79
|
+
*/
|
|
80
|
+
"playerMuteChange": (player: Player, selfMuted: boolean, serverMuted: boolean) => void;
|
|
81
|
+
/**
|
|
82
|
+
* Emitted when the player's selfDeafed or serverDeafed state changed (true -> false | false -> true)
|
|
83
|
+
* @event Manager#playerDeafChange
|
|
84
|
+
*/
|
|
85
|
+
"playerDeafChange": (player: Player, selfDeafed: boolean, serverDeafed: boolean) => void;
|
|
86
|
+
/**
|
|
87
|
+
* Emitted when the player's suppressed (true -> false | false -> true)
|
|
88
|
+
* @event Manager#playerSuppressChange
|
|
89
|
+
*/
|
|
90
|
+
"playerSuppressChange": (player: Player, suppress: boolean) => void;
|
|
91
|
+
/**
|
|
92
|
+
* Emitted when the player's queue got empty, and the timeout started
|
|
93
|
+
* @event Manager#playerQueueEmptyStart
|
|
94
|
+
*/
|
|
95
|
+
"playerQueueEmptyStart": (player: Player, timeoutMs: number) => void;
|
|
96
|
+
/**
|
|
97
|
+
* Emitted when the player's queue got empty, and the timeout finished leading to destroying the player
|
|
98
|
+
* @event Manager#playerQueueEmptyEnd
|
|
99
|
+
*/
|
|
100
|
+
"playerQueueEmptyEnd": (player: Player) => void;
|
|
101
|
+
/**
|
|
102
|
+
* Emitted when the player's queue got empty, and the timeout got cancelled becuase a track got re-added to it.
|
|
103
|
+
* @event Manager#playerQueueEmptyEnd
|
|
104
|
+
*/
|
|
105
|
+
"playerQueueEmptyCancel": (player: Player) => void;
|
|
106
|
+
/**
|
|
107
|
+
* Emitted, when a user joins the voice channel, while there is a player existing
|
|
108
|
+
* @event Manager#playerQueueEmptyStart
|
|
109
|
+
*/
|
|
110
|
+
"playerVoiceJoin": (player: Player, userId: string) => void;
|
|
111
|
+
/**
|
|
112
|
+
* Emitted, when a user leaves the voice channel, while there is a player existing
|
|
113
|
+
* @event Manager#playerQueueEmptyEnd
|
|
114
|
+
*/
|
|
115
|
+
"playerVoiceLeave": (player: Player, userId: string) => void;
|
|
76
116
|
/**
|
|
77
117
|
* SPONSORBLOCK-PLUGIN EVENT
|
|
78
118
|
* Emitted when Segments are loaded
|
|
@@ -114,6 +154,24 @@ export interface LavalinkManagerEvents {
|
|
|
114
154
|
error?: Error | string;
|
|
115
155
|
functionLayer: string;
|
|
116
156
|
}) => void;
|
|
157
|
+
/**
|
|
158
|
+
* Emitted when a Lyrics line is received
|
|
159
|
+
* @link https://github.com/topi314/LavaLyrics
|
|
160
|
+
* @event Manager#LyricsLine
|
|
161
|
+
*/
|
|
162
|
+
"LyricsLine": (player: Player, track: Track | UnresolvedTrack | null, payload: LyricsLineEvent) => void;
|
|
163
|
+
/**
|
|
164
|
+
* Emitted when a Lyrics is found
|
|
165
|
+
* @link https://github.com/topi314/LavaLyrics
|
|
166
|
+
* @event Manager#LyricsFound
|
|
167
|
+
*/
|
|
168
|
+
"LyricsFound": (player: Player, track: Track | UnresolvedTrack | null, payload: LyricsFoundEvent) => void;
|
|
169
|
+
/**
|
|
170
|
+
* Emitted when a Lyrics is not found
|
|
171
|
+
* @link https://github.com/topi314/LavaLyrics
|
|
172
|
+
* @event Manager#LyricsNotFound
|
|
173
|
+
*/
|
|
174
|
+
"LyricsNotFound": (player: Player, track: Track | UnresolvedTrack | null, payload: LyricsNotFoundEvent) => void;
|
|
117
175
|
}
|
|
118
176
|
/**
|
|
119
177
|
* The Bot client Options needed for the manager
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import type internal from "stream";
|
|
3
2
|
import type { LavalinkNode } from "../Node";
|
|
4
3
|
import type { DestroyReasonsType } from "./Player";
|
|
5
4
|
import type { InvalidLavalinkRestRequest, LavalinkPlayer } from "./Utils";
|
|
5
|
+
import type { PluginInfo } from "./Track";
|
|
6
6
|
/** Ability to manipulate fetch requests */
|
|
7
7
|
export type ModifyRequest = (options: RequestInit & {
|
|
8
8
|
path: string;
|
|
@@ -157,6 +157,28 @@ export interface PluginObject {
|
|
|
157
157
|
/** The version of the plugin */
|
|
158
158
|
version: string;
|
|
159
159
|
}
|
|
160
|
+
export interface LyricsResult {
|
|
161
|
+
/**The name of the source */
|
|
162
|
+
sourceName: string;
|
|
163
|
+
/**The name of the provider */
|
|
164
|
+
provider: string;
|
|
165
|
+
/**The result text */
|
|
166
|
+
text: string | null;
|
|
167
|
+
/**The lyrics lines */
|
|
168
|
+
lines: LyricsLine[];
|
|
169
|
+
/**Information about the plugin */
|
|
170
|
+
plugin: PluginInfo;
|
|
171
|
+
}
|
|
172
|
+
export interface LyricsLine {
|
|
173
|
+
/**The millisecond timestamp */
|
|
174
|
+
timestamp: number;
|
|
175
|
+
/**The line duration in milliseconds */
|
|
176
|
+
duration: number | null;
|
|
177
|
+
/**The line text */
|
|
178
|
+
line: string;
|
|
179
|
+
/**Information about the plugin */
|
|
180
|
+
plugin: PluginInfo;
|
|
181
|
+
}
|
|
160
182
|
export type LavalinkNodeIdentifier = string;
|
|
161
183
|
export interface NodeManagerEvents {
|
|
162
184
|
/**
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import type { DestroyReasons } from "../Constants";
|
|
1
|
+
import type { DestroyReasons, DisconnectReasons } from "../Constants";
|
|
2
2
|
import type { LavalinkNode } from "../Node";
|
|
3
3
|
import type { EQBand, FilterData, LavalinkFilterData } from "./Filters";
|
|
4
|
+
import type { StoredQueue } from "./Queue";
|
|
4
5
|
import type { Track, UnresolvedTrack } from "./Track";
|
|
5
6
|
import type { Base64, LavalinkPlayerVoiceOptions } from "./Utils";
|
|
6
7
|
export type DestroyReasonsType = keyof typeof DestroyReasons | string;
|
|
8
|
+
export type DisconnectReasonsType = keyof typeof DisconnectReasons | string;
|
|
7
9
|
export interface PlayerJson {
|
|
8
10
|
/** Guild Id where the player was playing in */
|
|
9
11
|
guildId: string;
|
|
@@ -46,6 +48,8 @@ export interface PlayerJson {
|
|
|
46
48
|
nodeId?: string;
|
|
47
49
|
/** The SessionId of the node */
|
|
48
50
|
nodeSessionId?: string;
|
|
51
|
+
/** The stored queue */
|
|
52
|
+
queue?: StoredQueue;
|
|
49
53
|
}
|
|
50
54
|
export type RepeatMode = "queue" | "track" | "off";
|
|
51
55
|
export interface PlayerOptions {
|
|
@@ -4,17 +4,17 @@ export interface StoredQueue {
|
|
|
4
4
|
previous: Track[];
|
|
5
5
|
tracks: (Track | UnresolvedTrack)[];
|
|
6
6
|
}
|
|
7
|
-
export interface QueueStoreManager
|
|
7
|
+
export interface QueueStoreManager {
|
|
8
8
|
/** @async get a Value (MUST RETURN UNPARSED!) */
|
|
9
|
-
get: (guildId:
|
|
9
|
+
get: (guildId: string) => Promise<StoredQueue | string>;
|
|
10
10
|
/** @async Set a value inside a guildId (MUST BE UNPARSED) */
|
|
11
|
-
set: (guildId:
|
|
11
|
+
set: (guildId: string, value: StoredQueue | string) => Promise<void | boolean>;
|
|
12
12
|
/** @async Delete a Database Value based of it's guildId */
|
|
13
|
-
delete: (guildId:
|
|
13
|
+
delete: (guildId: string) => Promise<void | boolean>;
|
|
14
14
|
/** @async Transform the value(s) inside of the QueueStoreManager (IF YOU DON'T NEED PARSING/STRINGIFY, then just return the value) */
|
|
15
|
-
stringify: (value:
|
|
15
|
+
stringify: (value: StoredQueue | string) => Promise<StoredQueue | string>;
|
|
16
16
|
/** @async Parse the saved value back to the Queue (IF YOU DON'T NEED PARSING/STRINGIFY, then just return the value) */
|
|
17
|
-
parse: (value:
|
|
17
|
+
parse: (value: StoredQueue | string) => Promise<Partial<StoredQueue>>;
|
|
18
18
|
}
|
|
19
19
|
export interface ManagerQueueOptions {
|
|
20
20
|
/** Maximum Amount of tracks for the queue.previous array. Set to 0 to not save previous songs. Defaults to 25 Tracks */
|
|
@@ -5,8 +5,10 @@ import type { Base64 } from "./Utils";
|
|
|
5
5
|
export type LavalinkSourceNames = "youtube" | "youtubemusic" | "soundcloud" | "bandcamp" | "twitch";
|
|
6
6
|
/** Source Names provided by lava src plugin */
|
|
7
7
|
export type LavalinkPlugin_LavaSrc_SourceNames = "deezer" | "spotify" | "applemusic" | "yandexmusic" | "flowery-tts";
|
|
8
|
+
/** Source Names provided by jiosaavan plugin */
|
|
9
|
+
export type LavalinkPlugin_JioSaavn_SourceNames = "jiosaavn";
|
|
8
10
|
/** The SourceNames provided by lavalink */
|
|
9
|
-
export type SourceNames = LavalinkSourceNames | LavalinkPlugin_LavaSrc_SourceNames;
|
|
11
|
+
export type SourceNames = LavalinkSourceNames | LavalinkPlugin_LavaSrc_SourceNames | LavalinkPlugin_JioSaavn_SourceNames;
|
|
10
12
|
export interface LavalinkTrackInfo {
|
|
11
13
|
/** The Identifier of the Track */
|
|
12
14
|
identifier: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MiniMap } from "../Utils";
|
|
2
2
|
import type { LavalinkFilterData } from "./Filters";
|
|
3
|
-
import type { NodeStats } from "./Node";
|
|
3
|
+
import type { LyricsLine, LyricsResult, NodeStats } from "./Node";
|
|
4
4
|
import type { LavalinkPlayOptions } from "./Player";
|
|
5
5
|
import type { LavalinkTrack, PluginInfo, Track, UnresolvedTrack } from "./Track";
|
|
6
6
|
/** Helper for generating Opaque types. */
|
|
@@ -13,15 +13,16 @@ export type IntegerNumber = Opaque<number, 'Int'>;
|
|
|
13
13
|
export type FloatNumber = Opaque<number, 'Float'>;
|
|
14
14
|
export type LavaSrcSearchPlatformBase = "spsearch" | "sprec" | "amsearch" | "dzsearch" | "dzisrc" | "ymsearch";
|
|
15
15
|
export type LavaSrcSearchPlatform = LavaSrcSearchPlatformBase | "ftts";
|
|
16
|
+
export type JioSaavnSearchPlatform = "jssearch" | "jsrec";
|
|
16
17
|
export type DuncteSearchPlatform = "speak" | "phsearch" | "pornhub" | "porn" | "tts";
|
|
17
18
|
export type LavalinkClientSearchPlatform = "bcsearch";
|
|
18
19
|
export type LavalinkClientSearchPlatformResolve = "bandcamp" | "bc";
|
|
19
|
-
export type LavalinkSearchPlatform = "ytsearch" | "ytmsearch" | "scsearch" | "bcsearch" | LavaSrcSearchPlatform | DuncteSearchPlatform | LavalinkClientSearchPlatform;
|
|
20
|
+
export type LavalinkSearchPlatform = "ytsearch" | "ytmsearch" | "scsearch" | "bcsearch" | LavaSrcSearchPlatform | DuncteSearchPlatform | JioSaavnSearchPlatform | LavalinkClientSearchPlatform;
|
|
20
21
|
export type ClientCustomSearchPlatformUtils = "local" | "http" | "https" | "link" | "uri";
|
|
21
22
|
export type ClientSearchPlatform = ClientCustomSearchPlatformUtils | // for file/link requests
|
|
22
|
-
"youtube" | "yt" | "youtube music" | "youtubemusic" | "ytm" | "musicyoutube" | "music youtube" | "soundcloud" | "sc" | "am" | "apple music" | "applemusic" | "apple" | "musicapple" | "music apple" | "sp" | "spsuggestion" | "spotify" | "spotify.com" | "spotifycom" | "dz" | "deezer" | "yandex" | "yandex music" | "yandexmusic" | "flowerytts" | "flowery" | "flowery.tts" | LavalinkClientSearchPlatformResolve | LavalinkClientSearchPlatform;
|
|
23
|
+
"youtube" | "yt" | "youtube music" | "youtubemusic" | "ytm" | "musicyoutube" | "music youtube" | "soundcloud" | "sc" | "am" | "apple music" | "applemusic" | "apple" | "musicapple" | "music apple" | "sp" | "spsuggestion" | "spotify" | "spotify.com" | "spotifycom" | "dz" | "deezer" | "yandex" | "yandex music" | "yandexmusic" | "flowerytts" | "flowery" | "flowery.tts" | LavalinkClientSearchPlatformResolve | LavalinkClientSearchPlatform | "js" | "jiosaavn";
|
|
23
24
|
export type SearchPlatform = LavalinkSearchPlatform | ClientSearchPlatform;
|
|
24
|
-
export type SourcesRegex = "YoutubeRegex" | "YoutubeMusicRegex" | "SoundCloudRegex" | "SoundCloudMobileRegex" | "DeezerTrackRegex" | "DeezerArtistRegex" | "DeezerEpisodeRegex" | "DeezerMixesRegex" | "DeezerPageLinkRegex" | "DeezerPlaylistRegex" | "DeezerAlbumRegex" | "AllDeezerRegex" | "AllDeezerRegexWithoutPageLink" | "SpotifySongRegex" | "SpotifyPlaylistRegex" | "SpotifyArtistRegex" | "SpotifyEpisodeRegex" | "SpotifyShowRegex" | "SpotifyAlbumRegex" | "AllSpotifyRegex" | "mp3Url" | "m3uUrl" | "m3u8Url" | "mp4Url" | "m4aUrl" | "wavUrl" | "aacpUrl" | "tiktok" | "mixcloud" | "musicYandex" | "radiohost" | "bandcamp" | "appleMusic" | "TwitchTv" | "vimeo";
|
|
25
|
+
export type SourcesRegex = "YoutubeRegex" | "YoutubeMusicRegex" | "SoundCloudRegex" | "SoundCloudMobileRegex" | "DeezerTrackRegex" | "DeezerArtistRegex" | "DeezerEpisodeRegex" | "DeezerMixesRegex" | "DeezerPageLinkRegex" | "DeezerPlaylistRegex" | "DeezerAlbumRegex" | "AllDeezerRegex" | "AllDeezerRegexWithoutPageLink" | "SpotifySongRegex" | "SpotifyPlaylistRegex" | "SpotifyArtistRegex" | "SpotifyEpisodeRegex" | "SpotifyShowRegex" | "SpotifyAlbumRegex" | "AllSpotifyRegex" | "mp3Url" | "m3uUrl" | "m3u8Url" | "mp4Url" | "m4aUrl" | "wavUrl" | "aacpUrl" | "tiktok" | "mixcloud" | "musicYandex" | "radiohost" | "bandcamp" | "jiosaavn" | "appleMusic" | "TwitchTv" | "vimeo";
|
|
25
26
|
export interface PlaylistInfo {
|
|
26
27
|
/** The playlist name */
|
|
27
28
|
name: string;
|
|
@@ -62,7 +63,7 @@ export interface MiniMapConstructor {
|
|
|
62
63
|
readonly prototype: MiniMap<unknown, unknown>;
|
|
63
64
|
readonly [Symbol.species]: MiniMapConstructor;
|
|
64
65
|
}
|
|
65
|
-
export type PlayerEvents = TrackStartEvent | TrackEndEvent | TrackStuckEvent | TrackExceptionEvent | WebSocketClosedEvent | SponsorBlockSegmentEvents;
|
|
66
|
+
export type PlayerEvents = TrackStartEvent | TrackEndEvent | TrackStuckEvent | TrackExceptionEvent | WebSocketClosedEvent | SponsorBlockSegmentEvents | LyricsEvent;
|
|
66
67
|
export type Severity = "COMMON" | "SUSPICIOUS" | "FAULT";
|
|
67
68
|
export interface Exception {
|
|
68
69
|
/** Severity of the error */
|
|
@@ -148,9 +149,66 @@ export interface SponsorBlockChaptersLoaded extends PlayerEvent {
|
|
|
148
149
|
duration: number;
|
|
149
150
|
}[];
|
|
150
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* Types & Events for Lyrics plugin from Lavalink: https://github.com/topi314/LavaLyrics
|
|
154
|
+
*/
|
|
155
|
+
export type LyricsEvent = LyricsFoundEvent | LyricsNotFoundEvent | LyricsLineEvent;
|
|
156
|
+
export type LyricsEventType = "LyricsFoundEvent" | "LyricsNotFoundEvent" | "LyricsLineEvent";
|
|
157
|
+
export interface LyricsFoundEvent extends PlayerEvent {
|
|
158
|
+
/** The lyricsfound event */
|
|
159
|
+
type: "LyricsFoundEvent";
|
|
160
|
+
/** The guildId */
|
|
161
|
+
guildId: string;
|
|
162
|
+
/** The lyrics */
|
|
163
|
+
lyrics: LyricsResult;
|
|
164
|
+
}
|
|
165
|
+
export interface LyricsNotFoundEvent extends PlayerEvent {
|
|
166
|
+
/**The lyricsnotfound event*/
|
|
167
|
+
type: "LyricsNotFoundEvent";
|
|
168
|
+
/**The guildId*/
|
|
169
|
+
guildId: string;
|
|
170
|
+
}
|
|
171
|
+
export interface LyricsLineEvent extends PlayerEvent {
|
|
172
|
+
/**The lyricsline event*/
|
|
173
|
+
type: "LyricsLineEvent";
|
|
174
|
+
/** The guildId */
|
|
175
|
+
guildId: string;
|
|
176
|
+
/** The line number */
|
|
177
|
+
lineIndex: number;
|
|
178
|
+
/** The line */
|
|
179
|
+
line: LyricsLine;
|
|
180
|
+
/**skipped is true if the line was skipped */
|
|
181
|
+
skipped: boolean;
|
|
182
|
+
}
|
|
183
|
+
export interface LyricsFoundEvent extends PlayerEvent {
|
|
184
|
+
/** The lyricsfound event */
|
|
185
|
+
type: "LyricsFoundEvent";
|
|
186
|
+
/** The guildId */
|
|
187
|
+
guildId: string;
|
|
188
|
+
/** The lyrics */
|
|
189
|
+
lyrics: LyricsResult;
|
|
190
|
+
}
|
|
191
|
+
export interface LyricsNotFoundEvent extends PlayerEvent {
|
|
192
|
+
/**The lyricsnotfound event*/
|
|
193
|
+
type: "LyricsNotFoundEvent";
|
|
194
|
+
/**The guildId*/
|
|
195
|
+
guildId: string;
|
|
196
|
+
}
|
|
197
|
+
export interface LyricsLineEvent extends PlayerEvent {
|
|
198
|
+
/**The lyricsline event*/
|
|
199
|
+
type: "LyricsLineEvent";
|
|
200
|
+
/** The guildId */
|
|
201
|
+
guildId: string;
|
|
202
|
+
/** The line number */
|
|
203
|
+
lineIndex: number;
|
|
204
|
+
/** The line */
|
|
205
|
+
line: LyricsLine;
|
|
206
|
+
/**skipped is true if the line was skipped */
|
|
207
|
+
skipped: boolean;
|
|
208
|
+
}
|
|
151
209
|
export type LoadTypes = "track" | "playlist" | "search" | "error" | "empty";
|
|
152
210
|
export type State = "CONNECTED" | "CONNECTING" | "DISCONNECTED" | "DISCONNECTING" | "DESTROYING";
|
|
153
|
-
export type PlayerEventType = "TrackStartEvent" | "TrackEndEvent" | "TrackExceptionEvent" | "TrackStuckEvent" | "WebSocketClosedEvent" | SponsorBlockSegmentEventType;
|
|
211
|
+
export type PlayerEventType = "TrackStartEvent" | "TrackEndEvent" | "TrackExceptionEvent" | "TrackStuckEvent" | "WebSocketClosedEvent" | SponsorBlockSegmentEventType | LyricsEventType;
|
|
154
212
|
export type TrackEndReason = "finished" | "loadFailed" | "stopped" | "replaced" | "cleanup";
|
|
155
213
|
export interface InvalidLavalinkRestRequest {
|
|
156
214
|
/** Rest Request Data for when it was made */
|
|
@@ -178,8 +236,7 @@ export interface LavalinkPlayerVoice {
|
|
|
178
236
|
/** The Ping to the voice server */
|
|
179
237
|
ping?: number;
|
|
180
238
|
}
|
|
181
|
-
export
|
|
182
|
-
}
|
|
239
|
+
export type LavalinkPlayerVoiceOptions = Omit<LavalinkPlayerVoice, 'connected' | 'ping'>;
|
|
183
240
|
export interface FailingAddress {
|
|
184
241
|
/** The failing address */
|
|
185
242
|
failingAddress: string;
|
|
@@ -295,6 +352,22 @@ export interface VoiceState {
|
|
|
295
352
|
session_id: string;
|
|
296
353
|
/** Voice Channel Id */
|
|
297
354
|
channel_id: string;
|
|
355
|
+
/** Server Mute status */
|
|
356
|
+
mute: boolean;
|
|
357
|
+
/** Server Deaf status */
|
|
358
|
+
deaf: boolean;
|
|
359
|
+
/** Self Deaf status */
|
|
360
|
+
self_deaf: boolean;
|
|
361
|
+
/** Self Mute status */
|
|
362
|
+
self_mute: boolean;
|
|
363
|
+
/** Self Video (Camera) status */
|
|
364
|
+
self_video: boolean;
|
|
365
|
+
/** Self Stream status */
|
|
366
|
+
self_stream: boolean;
|
|
367
|
+
/** Wether the user requests to speak (stage channel) */
|
|
368
|
+
request_to_speak_timestamp: boolean;
|
|
369
|
+
/** Self suppressed status (stage channel) */
|
|
370
|
+
suppress: boolean;
|
|
298
371
|
}
|
|
299
372
|
/** The Base64 decodes tring by lavalink */
|
|
300
373
|
export type Base64 = string;
|
package/package.json
CHANGED
|
@@ -1,20 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lavalink-client",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Easy, flexible and feature-rich lavalink@v4 Client. Both for Beginners and Proficients.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/types/index.d.js",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"build": "npm run
|
|
10
|
-
|
|
11
|
-
"build:
|
|
12
|
-
"build:
|
|
13
|
-
|
|
9
|
+
"build": "npm run tool:clean && npm run build:all && npm run tool:fixbuild",
|
|
10
|
+
|
|
11
|
+
"build:bun": "bun run tool:clean && bun run build:all:bun && bun run tool:fixbuild",
|
|
12
|
+
"build:all:bun": "bun run build:cjs && bun run build:esm && bun run build:types",
|
|
13
|
+
|
|
14
|
+
"build:all": "npm run build:cjs && npm run build:esm && npm run build:types",
|
|
15
|
+
"build:cjs": "tsc -p tools/config/tsconfig.cjs.json && tsc-alias -p tools/config/tsconfig.cjs.json",
|
|
16
|
+
"build:esm": "tsc -p tools/config/tsconfig.esm.json && tsc-alias -p tools/config/tsconfig.esm.json",
|
|
17
|
+
"build:types": "tsc -p tools/config/tsconfig.types.json && tsc-alias -p tools/config/tsconfig.types.json",
|
|
18
|
+
|
|
19
|
+
"tool:clean": "node tools/cleanup.js",
|
|
20
|
+
"tool:fixbuild": "node tools/fixup.js",
|
|
21
|
+
|
|
14
22
|
"lint": "eslint .",
|
|
15
23
|
"lint:fix": "npm run lint -- --fix",
|
|
24
|
+
|
|
16
25
|
"test": "node -v",
|
|
17
|
-
|
|
26
|
+
|
|
27
|
+
"prepublishOnly": "npm run build",
|
|
28
|
+
"prepare": "npm run build"
|
|
18
29
|
},
|
|
19
30
|
"exports": {
|
|
20
31
|
"require": "./dist/cjs/index.js",
|
|
@@ -51,21 +62,21 @@
|
|
|
51
62
|
"bugs": {
|
|
52
63
|
"url": "https://github.com/tomato6966/lavalink-client/issues"
|
|
53
64
|
},
|
|
54
|
-
"homepage": "https://
|
|
65
|
+
"homepage": "https://tomato6966.github.io/lavalink-client/",
|
|
55
66
|
"devDependencies": {
|
|
56
|
-
"@
|
|
57
|
-
"@
|
|
58
|
-
"@
|
|
59
|
-
"@
|
|
60
|
-
"eslint": "^8.
|
|
67
|
+
"@eslint/eslintrc": "^3.1.0",
|
|
68
|
+
"@eslint/js": "^9.11.0",
|
|
69
|
+
"@types/node": "^22.5.5",
|
|
70
|
+
"@types/ws": "^8.5.12",
|
|
71
|
+
"@typescript-eslint/eslint-plugin": "^8.6.0",
|
|
72
|
+
"@typescript-eslint/parser": "^8.6.0",
|
|
73
|
+
"eslint": "^9.11.0",
|
|
61
74
|
"tsc-alias": "^1.8.10",
|
|
62
|
-
"
|
|
63
|
-
"typedoc-theme-hierarchy": "^4.1.2",
|
|
64
|
-
"typescript": "^5.1.6"
|
|
75
|
+
"typescript": "^5.6.2"
|
|
65
76
|
},
|
|
66
77
|
"dependencies": {
|
|
67
|
-
"tslib": "^2.
|
|
68
|
-
"ws": "^8.
|
|
78
|
+
"tslib": "^2.7.0",
|
|
79
|
+
"ws": "^8.18.0"
|
|
69
80
|
},
|
|
70
81
|
"engines": {
|
|
71
82
|
"node": ">=18.0.0",
|