lavalink-client 1.0.0 → 1.0.2

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.
Files changed (76) hide show
  1. package/README.md +103 -152
  2. package/dist/cjs/index.d.ts +9 -0
  3. package/dist/cjs/index.js +12 -0
  4. package/dist/cjs/structures/Filters.d.ts +231 -0
  5. package/dist/cjs/structures/Filters.js +481 -0
  6. package/dist/cjs/structures/LavalinkManager.d.ts +124 -0
  7. package/dist/cjs/structures/LavalinkManager.js +168 -0
  8. package/dist/cjs/structures/LavalinkManagerStatics.d.ts +3 -0
  9. package/dist/cjs/structures/LavalinkManagerStatics.js +84 -0
  10. package/dist/cjs/structures/Node.d.ts +245 -0
  11. package/dist/cjs/structures/Node.js +602 -0
  12. package/dist/cjs/structures/NodeManager.d.ts +61 -0
  13. package/dist/cjs/structures/NodeManager.js +35 -0
  14. package/dist/cjs/structures/Player.d.ts +191 -0
  15. package/dist/cjs/structures/Player.js +395 -0
  16. package/dist/cjs/structures/Queue.d.ts +107 -0
  17. package/dist/cjs/structures/Queue.js +215 -0
  18. package/dist/cjs/structures/Track.d.ts +47 -0
  19. package/dist/cjs/structures/Track.js +2 -0
  20. package/dist/cjs/structures/Utils.d.ts +258 -0
  21. package/dist/cjs/structures/Utils.js +179 -0
  22. package/dist/esm/index.d.ts +9 -0
  23. package/dist/esm/index.js +9 -0
  24. package/dist/esm/structures/Filters.d.ts +231 -0
  25. package/dist/esm/structures/Filters.js +477 -0
  26. package/dist/esm/structures/LavalinkManager.d.ts +124 -0
  27. package/dist/esm/structures/LavalinkManager.js +164 -0
  28. package/dist/esm/structures/LavalinkManagerStatics.d.ts +3 -0
  29. package/dist/esm/structures/LavalinkManagerStatics.js +81 -0
  30. package/dist/esm/structures/Node.d.ts +245 -0
  31. package/dist/esm/structures/Node.js +597 -0
  32. package/dist/esm/structures/NodeManager.d.ts +61 -0
  33. package/dist/esm/structures/NodeManager.js +31 -0
  34. package/dist/esm/structures/Player.d.ts +191 -0
  35. package/dist/esm/structures/Player.js +391 -0
  36. package/dist/esm/structures/Queue.d.ts +107 -0
  37. package/dist/esm/structures/Queue.js +208 -0
  38. package/dist/esm/structures/Track.d.ts +47 -0
  39. package/dist/esm/structures/Track.js +1 -0
  40. package/dist/esm/structures/Utils.d.ts +258 -0
  41. package/dist/esm/structures/Utils.js +173 -0
  42. package/dist/index.d.ts +10 -0
  43. package/dist/index.js +13 -0
  44. package/dist/structures/Filters.d.ts +230 -0
  45. package/dist/structures/Filters.js +472 -0
  46. package/dist/structures/LavalinkManager.d.ts +47 -0
  47. package/dist/structures/LavalinkManager.js +36 -0
  48. package/dist/structures/LavalinkManagerStatics.d.ts +3 -0
  49. package/dist/structures/LavalinkManagerStatics.js +76 -0
  50. package/dist/structures/Node.d.ts +171 -0
  51. package/dist/structures/Node.js +462 -0
  52. package/dist/structures/NodeManager.d.ts +58 -0
  53. package/dist/structures/NodeManager.js +25 -0
  54. package/dist/structures/Player.d.ts +101 -0
  55. package/dist/structures/Player.js +232 -0
  56. package/dist/structures/PlayerManager.d.ts +62 -0
  57. package/dist/structures/PlayerManager.js +26 -0
  58. package/dist/structures/Queue.d.ts +93 -0
  59. package/dist/structures/Queue.js +160 -0
  60. package/dist/structures/QueueManager.d.ts +77 -0
  61. package/dist/structures/QueueManager.js +74 -0
  62. package/dist/structures/Track.d.ts +27 -0
  63. package/dist/structures/Track.js +2 -0
  64. package/dist/structures/Utils.d.ts +183 -0
  65. package/dist/structures/Utils.js +43 -0
  66. package/dist/types/index.d.ts +9 -0
  67. package/dist/types/structures/Filters.d.ts +231 -0
  68. package/dist/types/structures/LavalinkManager.d.ts +124 -0
  69. package/dist/types/structures/LavalinkManagerStatics.d.ts +3 -0
  70. package/dist/types/structures/Node.d.ts +245 -0
  71. package/dist/types/structures/NodeManager.d.ts +61 -0
  72. package/dist/types/structures/Player.d.ts +191 -0
  73. package/dist/types/structures/Queue.d.ts +107 -0
  74. package/dist/types/structures/Track.d.ts +47 -0
  75. package/dist/types/structures/Utils.d.ts +258 -0
  76. package/package.json +63 -26
@@ -0,0 +1,191 @@
1
+ import { FilterManager, LavalinkFilterData } from "./Filters";
2
+ import { LavalinkManager } from "./LavalinkManager";
3
+ import { LavalinkNode } from "./Node";
4
+ import { Queue } from "./Queue";
5
+ import { Track } from "./Track";
6
+ import { LavalinkPlayerVoiceOptions, SearchPlatform, SearchResult } from "./Utils";
7
+ type PlayerDestroyReasons = "QueueEmpty" | "NodeDestroy" | "NodeDeleted" | "LavalinkNoVoice" | "NodeReconnectFail" | "PlayerReconnectFail" | "Disconnected" | "ChannelDeleted";
8
+ export type DestroyReasonsType = PlayerDestroyReasons | string;
9
+ export declare const DestroyReasons: Record<PlayerDestroyReasons, PlayerDestroyReasons>;
10
+ export type RepeatMode = "queue" | "track" | "off";
11
+ export interface PlayerOptions {
12
+ guildId: string;
13
+ voiceChannelId: string;
14
+ volume?: number;
15
+ vcRegion?: string;
16
+ selfDeaf?: boolean;
17
+ selfMute?: boolean;
18
+ textChannelId?: string;
19
+ node?: LavalinkNode | string;
20
+ instaUpdateFiltersFix?: boolean;
21
+ applyVolumeAsFilter?: boolean;
22
+ }
23
+ export interface PlayOptions {
24
+ /** Which Track to play | don't provide, if it should pick from the Queue */
25
+ track?: Track;
26
+ /** Encoded Track to use, instead of the queue system... */
27
+ encodedTrack?: string | null;
28
+ /** Encoded Track to use&search, instead of the queue system (yt only)... */
29
+ identifier?: string;
30
+ /** The position to start the track. */
31
+ position?: number;
32
+ /** The position to end the track. */
33
+ endTime?: number;
34
+ /** Whether to not replace the track if a play payload is sent. */
35
+ noReplace?: boolean;
36
+ /** If to start "paused" */
37
+ paused?: boolean;
38
+ /** The Volume to start with */
39
+ volume?: number;
40
+ /** The Lavalink Filters to use | only with the new REST API */
41
+ filters?: Partial<LavalinkFilterData>;
42
+ voice?: LavalinkPlayerVoiceOptions;
43
+ }
44
+ export interface Player {
45
+ filterManager: FilterManager;
46
+ LavalinkManager: LavalinkManager;
47
+ options: PlayerOptions;
48
+ node: LavalinkNode;
49
+ queue: Queue;
50
+ }
51
+ export declare class Player {
52
+ /** The Guild Id of the Player */
53
+ guildId: string;
54
+ /** The Voice Channel Id of the Player */
55
+ voiceChannelId: string | null;
56
+ /** The Text Channel Id of the Player */
57
+ textChannelId: string | null;
58
+ /** States if the Bot is supposed to be outputting audio */
59
+ playing: boolean;
60
+ /** States if the Bot is paused or not */
61
+ paused: boolean;
62
+ /** Repeat Mode of the Player */
63
+ repeatMode: RepeatMode;
64
+ /** Player's ping */
65
+ ping: {
66
+ lavalink: number;
67
+ ws: number;
68
+ };
69
+ /** The Display Volume */
70
+ volume: number;
71
+ /** The Volume Lavalink actually is outputting */
72
+ lavalinkVolume: number;
73
+ /** The current Positin of the player (Calculated) */
74
+ position: number;
75
+ /** The current Positin of the player (from Lavalink) */
76
+ lastPosition: number;
77
+ /** When the player was created [Timestamp in Ms] (from lavalink) */
78
+ createdTimeStamp: number;
79
+ /** The Player Connection's State (from Lavalink) */
80
+ connected: boolean | undefined;
81
+ /** Voice Server Data (from Lavalink) */
82
+ voice: LavalinkPlayerVoiceOptions;
83
+ private readonly data;
84
+ /**
85
+ * Create a new Player
86
+ * @param options
87
+ * @param LavalinkManager
88
+ */
89
+ constructor(options: PlayerOptions, LavalinkManager: LavalinkManager);
90
+ /**
91
+ * Set custom data.
92
+ * @param key
93
+ * @param value
94
+ */
95
+ set(key: string, value: unknown): void;
96
+ /**
97
+ * Get custom data.
98
+ * @param key
99
+ */
100
+ get<T>(key: string): T;
101
+ /**
102
+ * CLears all the custom data.
103
+ */
104
+ clearData(): void;
105
+ /**
106
+ * Get all custom Data
107
+ */
108
+ getAllData(): Record<string, unknown>;
109
+ /**
110
+ * Play the next track from the queue / a specific track, with playoptions for Lavalink
111
+ * @param options
112
+ */
113
+ play(options?: Partial<PlayOptions>): Promise<void>;
114
+ /**
115
+ * Set the Volume for the Player
116
+ * @param volume The Volume in percent
117
+ * @param ignoreVolumeDecrementer If it should ignore the volumedecrementer option
118
+ */
119
+ setVolume(volume: number, ignoreVolumeDecrementer?: boolean): Promise<void>;
120
+ /**
121
+ *
122
+ * @param query Query for your data
123
+ * @param requestUser
124
+ */
125
+ search(query: {
126
+ query: string;
127
+ source?: SearchPlatform;
128
+ } | string, requestUser: unknown): Promise<SearchResult>;
129
+ /**
130
+ * Pause the player
131
+ */
132
+ pause(): Promise<void>;
133
+ /**
134
+ * Resume the Player
135
+ */
136
+ resume(): Promise<void>;
137
+ /**
138
+ * Seek to a specific Position
139
+ * @param position
140
+ */
141
+ seek(position: number): Promise<any>;
142
+ /**
143
+ * Set the Repeatmode of the Player
144
+ * @param repeatMode
145
+ */
146
+ setRepeatMode(repeatMode: RepeatMode): Promise<void>;
147
+ /**
148
+ * Skip the current song, or a specific amount of songs
149
+ * @param amount provide the index of the next track to skip to
150
+ */
151
+ skip(skipTo?: number): Promise<true | void>;
152
+ /**
153
+ * Connects the Player to the Voice Channel
154
+ * @returns
155
+ */
156
+ connect(): Promise<void>;
157
+ /**
158
+ * Disconnects the Player from the Voice Channel, but keeps the player in the cache
159
+ * @param force If false it throws an error, if player thinks it's already disconnected
160
+ * @returns
161
+ */
162
+ disconnect(force?: boolean): Promise<void>;
163
+ /**
164
+ * Destroy the player and disconnect from the voice channel
165
+ */
166
+ destroy(reason?: string): Promise<void>;
167
+ /**
168
+ * Move the player on a different Audio-Node
169
+ * @param newNode New Node / New Node Id
170
+ */
171
+ changeNode(newNode: LavalinkNode | string): Promise<string>;
172
+ /** Converts the Player including Queue to a Json state */
173
+ toJSON(): {
174
+ guildId: string;
175
+ voiceChannelId: string;
176
+ textChannelId: string;
177
+ position: number;
178
+ lastPosition: number;
179
+ volume: number;
180
+ lavalinkVolume: number;
181
+ repeatMode: RepeatMode;
182
+ paused: boolean;
183
+ playing: boolean;
184
+ createdTimeStamp: number;
185
+ filters: {};
186
+ equalizer: import("./Filters").EQBand[];
187
+ queue: import("./Queue").StoredQueue;
188
+ nodeId: string;
189
+ };
190
+ }
191
+ export {};
@@ -0,0 +1,107 @@
1
+ import { Track } from "./Track";
2
+ export interface StoredQueue {
3
+ current: Track | null;
4
+ previous: Track[];
5
+ tracks: Track[];
6
+ }
7
+ export interface StoreManager extends Record<any, any> {
8
+ /** @async get a Value (MUST RETURN UNPARSED!) */
9
+ get: (guildId: unknown) => Promise<any>;
10
+ /** @async Set a value inside a guildId (MUST BE UNPARSED) */
11
+ set: (guildId: unknown, value: unknown) => Promise<any>;
12
+ /** @async Delete a Database Value based of it's guildId */
13
+ delete: (guildId: unknown) => Promise<any>;
14
+ /** @async Transform the value(s) inside of the StoreManager (IF YOU DON'T NEED PARSING/STRINGIFY, then just return the value) */
15
+ stringify: (value: unknown) => Promise<any>;
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: unknown) => Promise<Partial<StoredQueue>>;
18
+ }
19
+ export interface QueueSaverOptions {
20
+ maxPreviousTracks: number;
21
+ }
22
+ export interface QueueSaver {
23
+ /** @private */
24
+ _: StoreManager;
25
+ /** @private */
26
+ options: QueueSaverOptions;
27
+ }
28
+ export declare class QueueSaver {
29
+ constructor(storeManager: StoreManager, options: QueueSaverOptions);
30
+ get(guildId: string): Promise<Partial<StoredQueue>>;
31
+ delete(guildId: string): Promise<any>;
32
+ set(guildId: string, value: any): Promise<any>;
33
+ sync(guildId: string): Promise<Partial<StoredQueue>>;
34
+ }
35
+ export declare class DefaultQueueStore {
36
+ private data;
37
+ constructor();
38
+ get(guildId: any): Promise<any>;
39
+ set(guildId: any, stringifiedValue: any): Promise<Map<any, any>>;
40
+ delete(guildId: any): Promise<boolean>;
41
+ stringify(value: any): Promise<any>;
42
+ parse(value: any): Promise<Partial<StoredQueue>>;
43
+ }
44
+ export declare class QueueChangesWatcher {
45
+ constructor();
46
+ tracksAdd(guildId: string, tracks: Track[], position: number, oldStoredQueue: StoredQueue, newStoredQueue: StoredQueue): void;
47
+ tracksRemoved(guildId: string, tracks: Track[], position: number, oldStoredQueue: StoredQueue, newStoredQueue: StoredQueue): void;
48
+ shuffled(guildId: string, oldStoredQueue: StoredQueue, newStoredQueue: StoredQueue): void;
49
+ }
50
+ export declare class Queue {
51
+ readonly tracks: Track[];
52
+ readonly previous: Track[];
53
+ current: Track | null;
54
+ options: {
55
+ maxPreviousTracks: number;
56
+ };
57
+ private readonly guildId;
58
+ protected readonly QueueSaver: QueueSaver | null;
59
+ static readonly StaticSymbol: Symbol;
60
+ private managerUtils;
61
+ private queueChanges;
62
+ constructor(guildId: string, data?: Partial<StoredQueue>, QueueSaver?: QueueSaver, queueChangesWatcher?: QueueChangesWatcher);
63
+ /**
64
+ * Utils for a Queue
65
+ */
66
+ utils: {
67
+ /**
68
+ * Save the current cached Queue on the database/server (overides the server)
69
+ */
70
+ save: () => Promise<any>;
71
+ /**
72
+ * Sync the current queue database/server with the cached one
73
+ * @returns {void}
74
+ */
75
+ sync: (override?: boolean, dontSyncCurrent?: boolean) => Promise<void>;
76
+ destroy: () => Promise<any>;
77
+ /**
78
+ * @returns {{current:Track|null, previous:Track[], tracks:Track[]}}The Queue, but in a raw State, which allows easier handling for the storeManager
79
+ */
80
+ getStored: () => StoredQueue;
81
+ /**
82
+ * Get the Total Duration of the Queue-Songs summed up
83
+ * @returns {number}
84
+ */
85
+ totalDuration: () => number;
86
+ };
87
+ /**
88
+ * Shuffles the current Queue, then saves it
89
+ * @returns Amount of Tracks in the Queue
90
+ */
91
+ shuffle(): Promise<number>;
92
+ /**
93
+ * Add a Track to the Queue, and after saved in the "db" it returns the amount of the Tracks
94
+ * @param {Track | Track[]} TrackOrTracks
95
+ * @param {number} index At what position to add the Track
96
+ * @returns {number} Queue-Size (for the next Tracks)
97
+ */
98
+ add(TrackOrTracks: Track | Track[], index?: number): any;
99
+ /**
100
+ * Splice the tracks in the Queue
101
+ * @param {number} index Where to remove the Track
102
+ * @param {number} amount How many Tracks to remove?
103
+ * @param {Track | Track[]} TrackOrTracks Want to Add more Tracks?
104
+ * @returns {Track} Spliced Track
105
+ */
106
+ splice(index: number, amount: number, TrackOrTracks?: Track | Track[]): any;
107
+ }
@@ -0,0 +1,47 @@
1
+ import { Base64 } from "./Utils";
2
+ export interface TrackInfo {
3
+ identifier: string;
4
+ title: string;
5
+ author: string;
6
+ duration: number;
7
+ artworkUrl: string | null;
8
+ uri: string;
9
+ sourceName: string;
10
+ isSeekable: boolean;
11
+ isStream: boolean;
12
+ isrc: string | null;
13
+ }
14
+ export interface PluginInfo {
15
+ /** The Type provided by a plugin */
16
+ type?: string;
17
+ /** The Identifier provided by a plugin */
18
+ identifier?: string;
19
+ /** The ArtworkUrl provided by a plugin */
20
+ artworkUrl?: string;
21
+ /** The Author Information provided by a plugin */
22
+ author?: string;
23
+ /** The Url provided by a Plugin */
24
+ url?: string;
25
+ /** The Url provided by a Plugin */
26
+ uri?: string;
27
+ }
28
+ export interface LavalinkTrack {
29
+ /** The Base 64 encoded String */
30
+ encoded?: Base64;
31
+ /** Track Information */
32
+ info: TrackInfo;
33
+ /** Plugin Information from Lavalink */
34
+ pluginInfo: Partial<PluginInfo>;
35
+ }
36
+ export interface Track extends LavalinkTrack {
37
+ /** The Track's Requester */
38
+ requester?: unknown;
39
+ }
40
+ export interface UnresolvedQuery {
41
+ /** The base64 of the unresolved track to "encode" */
42
+ encoded?: Base64;
43
+ /** Search for the closest track possible, by providing as much information as you can! */
44
+ info?: Partial<TrackInfo>;
45
+ /** The Track's Requester */
46
+ requester?: unknown;
47
+ }
@@ -0,0 +1,258 @@
1
+ import { LavalinkFilterData } from "./Filters";
2
+ import { LavalinkManager } from "./LavalinkManager";
3
+ import { LavalinkNode, NodeStats } from "./Node";
4
+ import { PlayOptions } from "./Player";
5
+ import { Queue } from "./Queue";
6
+ import { PluginInfo, Track } from "./Track";
7
+ export declare const TrackSymbol: unique symbol;
8
+ export declare const UnresolvedTrackSymbol: unique symbol;
9
+ export declare const QueueSymbol: unique symbol;
10
+ export declare const NodeSymbol: unique symbol;
11
+ export type LavalinkSearchPlatform = "ytsearch" | "ytmsearch" | "scsearch" | "spsearch" | "sprec" | "amsearch" | "dzsearch" | "dzisrc" | "sprec" | "ymsearch" | "speak" | "tts";
12
+ export type ClientSearchPlatform = "youtube" | "yt" | "yt" | "youtube music" | "youtubemusic" | "ytm" | "soundcloud" | "sc" | "am" | "apple music" | "applemusic" | "apple" | "yandex music" | "sp" | "sprec" | "spsuggestion" | "spotify" | "dz" | "deezer" | "yandex" | "yandexmusic";
13
+ export type SearchPlatform = LavalinkSearchPlatform | ClientSearchPlatform;
14
+ 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";
15
+ export interface PlaylistInfo {
16
+ /** The playlist title. */
17
+ title: string;
18
+ /** The Playlist Author */
19
+ author?: string;
20
+ /** The Playlist Thumbnail */
21
+ thumbnail?: string;
22
+ /** A Uri to the playlist */
23
+ uri?: string;
24
+ /** The playlist selected track. */
25
+ selectedTrack: Track | null;
26
+ /** The duration of the entire playlist. (calcualted) */
27
+ duration: number;
28
+ }
29
+ export interface SearchResult {
30
+ loadType: LoadTypes;
31
+ exception: Exception | null;
32
+ pluginInfo: PluginInfo;
33
+ playlist: PlaylistInfo | null;
34
+ tracks: Track[];
35
+ }
36
+ export interface ManagerUitls {
37
+ /** @private */
38
+ manager: LavalinkManager;
39
+ }
40
+ export declare class ManagerUitls {
41
+ constructor(LavalinkManager?: LavalinkManager);
42
+ buildTrack(data: any, requester: any): Track;
43
+ /**
44
+ * Validate if a data is euqal to a track
45
+ * @param {Track|any} data the Track to validate
46
+ * @returns {boolean}
47
+ */
48
+ isTrack(data: Track | any): boolean;
49
+ validatedQuery(queryString: string, node: LavalinkNode): void;
50
+ }
51
+ /**
52
+ * @internal
53
+ */
54
+ export interface MiniMapConstructor {
55
+ new (): MiniMap<unknown, unknown>;
56
+ new <K, V>(entries?: ReadonlyArray<readonly [K, V]> | null): MiniMap<K, V>;
57
+ new <K, V>(iterable: Iterable<readonly [K, V]>): MiniMap<K, V>;
58
+ readonly prototype: MiniMap<unknown, unknown>;
59
+ readonly [Symbol.species]: MiniMapConstructor;
60
+ }
61
+ /**
62
+ * Separate interface for the constructor so that emitted js does not have a constructor that overwrites itself
63
+ *
64
+ * @internal
65
+ */
66
+ export interface MiniMap<K, V> extends Map<K, V> {
67
+ constructor: MiniMapConstructor;
68
+ }
69
+ export declare class MiniMap<K, V> extends Map<K, V> {
70
+ constructor(data?: any[]);
71
+ /**
72
+ * Identical to
73
+ * [Array.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter),
74
+ * but returns a MiniMap instead of an Array.
75
+ *
76
+ * @param fn The function to test with (should return boolean)
77
+ * @param thisArg Value to use as `this` when executing function
78
+ *
79
+ * @example
80
+ * miniMap.filter(user => user.username === 'Bob');
81
+ */
82
+ filter<K2 extends K>(fn: (value: V, key: K, miniMap: this) => key is K2): MiniMap<K2, V>;
83
+ filter<V2 extends V>(fn: (value: V, key: K, miniMap: this) => value is V2): MiniMap<K, V2>;
84
+ filter(fn: (value: V, key: K, miniMap: this) => boolean): MiniMap<K, V>;
85
+ filter<This, K2 extends K>(fn: (this: This, value: V, key: K, miniMap: this) => key is K2, thisArg: This): MiniMap<K2, V>;
86
+ filter<This, V2 extends V>(fn: (this: This, value: V, key: K, miniMap: this) => value is V2, thisArg: This): MiniMap<K, V2>;
87
+ filter<This>(fn: (this: This, value: V, key: K, miniMap: this) => boolean, thisArg: This): MiniMap<K, V>;
88
+ /**
89
+ * Maps each item to another value into an array. Identical in behavior to
90
+ * [Array.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map).
91
+ *
92
+ * @param fn Function that produces an element of the new array, taking three arguments
93
+ * @param thisArg Value to use as `this` when executing function
94
+ *
95
+ * @example
96
+ * miniMap.map(user => user.tag);
97
+ */
98
+ map<T>(fn: (value: V, key: K, miniMap: this) => T): T[];
99
+ map<This, T>(fn: (this: This, value: V, key: K, miniMap: this) => T, thisArg: This): T[];
100
+ }
101
+ export type PlayerEvents = TrackStartEvent | TrackEndEvent | TrackStuckEvent | TrackExceptionEvent | WebSocketClosedEvent;
102
+ export type Severity = "COMMON" | "SUSPICIOUS" | "FAULT";
103
+ export interface Exception {
104
+ severity: Severity;
105
+ message: string;
106
+ cause: string;
107
+ }
108
+ export interface PlayerEvent {
109
+ op: "event";
110
+ type: PlayerEventType;
111
+ guildId: string;
112
+ }
113
+ export interface TrackStartEvent extends PlayerEvent {
114
+ type: "TrackStartEvent";
115
+ track: string;
116
+ }
117
+ export interface TrackEndEvent extends PlayerEvent {
118
+ type: "TrackEndEvent";
119
+ track: string;
120
+ reason: TrackEndReason;
121
+ }
122
+ export interface TrackExceptionEvent extends PlayerEvent {
123
+ type: "TrackExceptionEvent";
124
+ exception?: Exception;
125
+ error: string;
126
+ }
127
+ export interface TrackStuckEvent extends PlayerEvent {
128
+ type: "TrackStuckEvent";
129
+ thresholdMs: number;
130
+ }
131
+ export interface WebSocketClosedEvent extends PlayerEvent {
132
+ type: "WebSocketClosedEvent";
133
+ code: number;
134
+ byRemote: boolean;
135
+ reason: string;
136
+ }
137
+ export type LoadTypes = "track" | "playlist" | "search" | "error" | "empty";
138
+ export type State = "CONNECTED" | "CONNECTING" | "DISCONNECTED" | "DISCONNECTING" | "DESTROYING";
139
+ export type PlayerEventType = "TrackStartEvent" | "TrackEndEvent" | "TrackExceptionEvent" | "TrackStuckEvent" | "WebSocketClosedEvent";
140
+ export type TrackEndReason = "finished" | "loadFailed" | "stopped" | "replaced" | "cleanup";
141
+ export interface InvalidLavalinkRestRequest {
142
+ timestamp: number;
143
+ status: number;
144
+ error: string;
145
+ message?: string;
146
+ path: string;
147
+ }
148
+ export interface LavalinkPlayerVoice {
149
+ token: string;
150
+ endpoint: string;
151
+ sessionId: string;
152
+ connected?: boolean;
153
+ ping?: number;
154
+ }
155
+ export interface LavalinkPlayerVoiceOptions extends Omit<LavalinkPlayerVoice, 'connected' | 'ping'> {
156
+ }
157
+ export interface FailingAddress {
158
+ /** The failing address */
159
+ failingAddress: string;
160
+ /** The timestamp when the address failed */
161
+ failingTimestamp: number;
162
+ /** The timestamp when the address failed as a pretty string */
163
+ failingTime: string;
164
+ }
165
+ type RoutePlannerTypes = "RotatingIpRoutePlanner" | "NanoIpRoutePlanner" | "RotatingNanoIpRoutePlanner" | "BalancingIpRoutePlanner";
166
+ export interface RoutePlanner {
167
+ class?: RoutePlannerTypes;
168
+ details?: {
169
+ /** The ip block being used */
170
+ ipBlock: {
171
+ /** The type of the ip block */
172
+ type: "Inet4Address" | "Inet6Address";
173
+ /** The size of the ip block */
174
+ size: string;
175
+ };
176
+ /** The failing addresses */
177
+ failingAddresses: FailingAddress[];
178
+ /** The number of rotations */
179
+ rotateIndex?: string;
180
+ /** The current offset in the block */
181
+ ipIndex?: string;
182
+ /** The current address being used */
183
+ currentAddress?: string;
184
+ /** The current offset in the ip block */
185
+ currentAddressIndex?: string;
186
+ /** The information in which /64 block ips are chosen. This number increases on each ban. */
187
+ blockIndex?: string;
188
+ };
189
+ }
190
+ export interface Session {
191
+ resuming: boolean;
192
+ timeout: number;
193
+ }
194
+ export interface GuildShardPayload {
195
+ /** The OP code */
196
+ op: number;
197
+ d: {
198
+ guild_id: string;
199
+ channel_id: string | null;
200
+ self_mute: boolean;
201
+ self_deaf: boolean;
202
+ };
203
+ }
204
+ export interface PlayerUpdateInfo {
205
+ guildId: string;
206
+ playerOptions: PlayOptions;
207
+ noReplace?: boolean;
208
+ }
209
+ export interface LavalinkPlayer {
210
+ guildId: string;
211
+ track?: {
212
+ encoded?: string;
213
+ info: {
214
+ identifier: string;
215
+ title: string;
216
+ author: string;
217
+ length: number;
218
+ artworkUrl: string | null;
219
+ uri: string;
220
+ sourceName: string;
221
+ isSeekable: boolean;
222
+ isStream: boolean;
223
+ isrc: string | null;
224
+ position?: number;
225
+ };
226
+ };
227
+ volume: number;
228
+ paused: boolean;
229
+ voice: LavalinkPlayerVoice;
230
+ filters: Partial<LavalinkFilterData>;
231
+ }
232
+ export interface VoiceState {
233
+ op: "voiceUpdate";
234
+ guildId: string;
235
+ event: VoiceServer;
236
+ sessionId?: string;
237
+ guild_id: string;
238
+ user_id: string;
239
+ session_id: string;
240
+ channel_id: string;
241
+ }
242
+ export type Base64 = string;
243
+ export interface VoiceServer {
244
+ token: string;
245
+ guild_id: string;
246
+ endpoint: string;
247
+ }
248
+ export interface VoicePacket {
249
+ t?: "VOICE_SERVER_UPDATE" | "VOICE_STATE_UPDATE";
250
+ d: VoiceState | VoiceServer;
251
+ }
252
+ export interface NodeMessage extends NodeStats {
253
+ type: PlayerEventType;
254
+ op: "stats" | "playerUpdate" | "event";
255
+ guildId: string;
256
+ }
257
+ export declare function queueTrackEnd(queue: Queue, addBackToQueue?: boolean): Promise<Track>;
258
+ export {};