aqualink 2.19.0 → 2.20.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/build/handlers/autoplay.js +22 -6
- package/build/handlers/fetchImage.js +2 -4
- package/build/index.d.ts +383 -5
- package/build/index.js +48 -0
- package/build/structures/Aqua.js +265 -74
- package/build/structures/AqualinkEvents.js +0 -2
- package/build/structures/Connection.js +145 -24
- package/build/structures/Filters.js +53 -5
- package/build/structures/Node.js +40 -5
- package/build/structures/Player.js +166 -58
- package/build/structures/Plugins.js +2 -2
- package/build/structures/Queue.js +13 -12
- package/build/structures/Rest.js +159 -142
- package/build/structures/Track.js +13 -6
- package/package.json +3 -4
|
@@ -1,14 +1,29 @@
|
|
|
1
|
-
const https = require('https')
|
|
1
|
+
const https = require('node:https')
|
|
2
2
|
|
|
3
|
+
// Default agent config (used only if shared agent not provided)
|
|
3
4
|
const AGENT_CONFIG = {
|
|
4
5
|
keepAlive: true,
|
|
5
|
-
maxSockets:
|
|
6
|
-
maxFreeSockets:
|
|
6
|
+
maxSockets: 64,
|
|
7
|
+
maxFreeSockets: 32,
|
|
7
8
|
timeout: 8000,
|
|
8
9
|
freeSocketTimeout: 4000
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
// Shared agent reference - can be set from Rest module
|
|
13
|
+
let sharedAgent = null
|
|
14
|
+
const getAgent = () => {
|
|
15
|
+
if (!sharedAgent) {
|
|
16
|
+
sharedAgent = new https.Agent(AGENT_CONFIG)
|
|
17
|
+
}
|
|
18
|
+
return sharedAgent
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Allow Rest module to inject its agent
|
|
22
|
+
const setSharedAgent = (agent) => {
|
|
23
|
+
if (agent && typeof agent.request === 'function') {
|
|
24
|
+
sharedAgent = agent
|
|
25
|
+
}
|
|
26
|
+
}
|
|
12
27
|
|
|
13
28
|
const SC_LINK_RE = /<a\s+itemprop="url"\s+href="(\/[^"]+)"/g
|
|
14
29
|
const MAX_REDIRECTS = 3
|
|
@@ -23,7 +38,7 @@ const fastFetch = (url, depth = 0) =>
|
|
|
23
38
|
|
|
24
39
|
const req = https.get(
|
|
25
40
|
url,
|
|
26
|
-
{ agent, timeout: DEFAULT_TIMEOUT_MS },
|
|
41
|
+
{ agent: getAgent(), timeout: DEFAULT_TIMEOUT_MS },
|
|
27
42
|
(res) => {
|
|
28
43
|
const { statusCode, headers } = res
|
|
29
44
|
|
|
@@ -132,5 +147,6 @@ const spAutoPlay = async (seed, player, requester, excludedIds = []) => {
|
|
|
132
147
|
|
|
133
148
|
module.exports = {
|
|
134
149
|
scAutoPlay,
|
|
135
|
-
spAutoPlay
|
|
150
|
+
spAutoPlay,
|
|
151
|
+
setSharedAgent
|
|
136
152
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const https = require('https')
|
|
1
|
+
const https = require('node:https')
|
|
2
2
|
|
|
3
3
|
const sourceHandlers = {
|
|
4
4
|
spotify: fetchSpotifyThumbnail,
|
|
@@ -80,9 +80,7 @@ async function fetchYouTubeThumbnail(identifier) {
|
|
|
80
80
|
try {
|
|
81
81
|
const exists = await checkImageExists(url)
|
|
82
82
|
if (exists) return url
|
|
83
|
-
} catch (
|
|
84
|
-
continue
|
|
85
|
-
}
|
|
83
|
+
} catch (_error) {}
|
|
86
84
|
}
|
|
87
85
|
|
|
88
86
|
return null
|
package/build/index.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ declare module 'aqualink' {
|
|
|
29
29
|
allowedDomains: string[]
|
|
30
30
|
loadBalancer: LoadBalancerStrategy
|
|
31
31
|
send: (payload: any) => void
|
|
32
|
+
autoRegionMigrate: boolean
|
|
32
33
|
|
|
33
34
|
// Internal State Management
|
|
34
35
|
_nodeStates: Map<
|
|
@@ -50,16 +51,81 @@ declare module 'aqualink' {
|
|
|
50
51
|
get leastUsedNodes(): Node[]
|
|
51
52
|
|
|
52
53
|
// Core Methods
|
|
54
|
+
/**
|
|
55
|
+
* Initializes the specific client id and connects to all nodes
|
|
56
|
+
* @param clientId Client ID
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* await aqua.init(client.user.id);
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
53
62
|
init(clientId: string): Promise<Aqua>
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Creates a new node connection
|
|
66
|
+
* @param options Modified node options
|
|
67
|
+
*/
|
|
54
68
|
createNode(options: NodeOptions): Promise<Node>
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Destroys a node by identifier
|
|
72
|
+
* @param identifier Node identifier (name or host)
|
|
73
|
+
*/
|
|
55
74
|
destroyNode(identifier: string): void
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Updates the voice state of a player
|
|
78
|
+
* @param data Voice state update packet
|
|
79
|
+
*/
|
|
56
80
|
updateVoiceState(data: VoiceStateUpdate | VoiceServerUpdate): void
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Fetches nodes in a specific region
|
|
84
|
+
* @param region Region name
|
|
85
|
+
*/
|
|
57
86
|
fetchRegion(region: string): Node[]
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Creates a connection for a player
|
|
90
|
+
* @param options Connection options
|
|
91
|
+
*/
|
|
58
92
|
createConnection(options: ConnectionOptions): Player
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Creates a player on a specific node
|
|
96
|
+
* @param node Node to create player on
|
|
97
|
+
* @param options Player options
|
|
98
|
+
*/
|
|
59
99
|
createPlayer(node: Node, options: PlayerOptions): Player
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Destroys a player
|
|
103
|
+
* @param guildId Guild ID
|
|
104
|
+
*/
|
|
60
105
|
destroyPlayer(guildId: string): Promise<void>
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Resolves a track or playlist
|
|
109
|
+
* @param options Resolution options
|
|
110
|
+
* @example
|
|
111
|
+
* ```ts
|
|
112
|
+
* const result = await aqua.resolve({ query: 'https://...', requester: user });
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
61
115
|
resolve(options: ResolveOptions): Promise<ResolveResponse>
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Gets an existing player
|
|
119
|
+
* @param guildId Guild ID
|
|
120
|
+
*/
|
|
62
121
|
get(guildId: string): Player
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Searches for tracks
|
|
125
|
+
* @param query Search query
|
|
126
|
+
* @param requester Requester object
|
|
127
|
+
* @param source Search source (ytsearch, scsearch, etc)
|
|
128
|
+
*/
|
|
63
129
|
search(
|
|
64
130
|
query: string,
|
|
65
131
|
requester: any,
|
|
@@ -68,14 +134,32 @@ declare module 'aqualink' {
|
|
|
68
134
|
|
|
69
135
|
// Save/Load Methods
|
|
70
136
|
savePlayer(filePath?: string): Promise<void>
|
|
137
|
+
savePlayerSync(filePath?: string): void
|
|
71
138
|
loadPlayers(filePath?: string): Promise<void>
|
|
72
139
|
|
|
73
140
|
// Failover and Migration Methods
|
|
74
141
|
handleNodeFailover(failedNode: Node): Promise<void>
|
|
75
142
|
|
|
143
|
+
/**
|
|
144
|
+
* Moves a player to a different node
|
|
145
|
+
* @param guildId Guild ID of the player
|
|
146
|
+
* @param targetNode Target node to move to
|
|
147
|
+
* @param reason Reason for migration (default: 'region')
|
|
148
|
+
*/
|
|
149
|
+
movePlayerToNode(
|
|
150
|
+
guildId: string,
|
|
151
|
+
targetNode: Node,
|
|
152
|
+
reason?: string
|
|
153
|
+
): Promise<Player>
|
|
154
|
+
|
|
76
155
|
// Utility Methods
|
|
156
|
+
/**
|
|
157
|
+
* Destroys the Aqua instance and all players
|
|
158
|
+
*/
|
|
77
159
|
destroy(): Promise<void>
|
|
78
160
|
|
|
161
|
+
getTrace(limit?: number): TraceEntry[]
|
|
162
|
+
|
|
79
163
|
// Internal Methods
|
|
80
164
|
_invalidateCache(): void
|
|
81
165
|
_getCachedNodeLoad(node: Node): number
|
|
@@ -122,6 +206,8 @@ declare module 'aqualink' {
|
|
|
122
206
|
_bindEventHandlers(): void
|
|
123
207
|
_startCleanupTimer(): void
|
|
124
208
|
_onNodeReady(node: Node, data: { resumed: boolean }): void
|
|
209
|
+
_regionMatches(configuredRegion: string, extractedRegion: string): boolean
|
|
210
|
+
_findBestNodeForRegion(region: string): Node | null
|
|
125
211
|
|
|
126
212
|
// Optional bypass checks
|
|
127
213
|
bypassChecks?: { nodeFetchInfo?: boolean }
|
|
@@ -142,7 +228,7 @@ declare module 'aqualink' {
|
|
|
142
228
|
auth: string
|
|
143
229
|
ssl: boolean
|
|
144
230
|
sessionId: string | null
|
|
145
|
-
regions:
|
|
231
|
+
regions: DiscordVoiceRegion[]
|
|
146
232
|
wsUrl: string
|
|
147
233
|
rest: Rest
|
|
148
234
|
resumeTimeout: number
|
|
@@ -168,7 +254,7 @@ declare module 'aqualink' {
|
|
|
168
254
|
_isConnecting: boolean
|
|
169
255
|
_debugEnabled: boolean
|
|
170
256
|
_headers: Record<string, string>
|
|
171
|
-
_boundHandlers: Record<string,
|
|
257
|
+
_boundHandlers: Record<string, ReturnType<typeof this._boundHandlers>>
|
|
172
258
|
|
|
173
259
|
// Methods
|
|
174
260
|
connect(): Promise<void>
|
|
@@ -244,29 +330,122 @@ declare module 'aqualink' {
|
|
|
244
330
|
_boundPlayerUpdate: (packet: any) => void
|
|
245
331
|
_boundEvent: (payload: any) => void
|
|
246
332
|
_boundAquaPlayerMove: (oldChannel: string, newChannel: string) => void
|
|
333
|
+
_lastVoiceChannel: string | null
|
|
334
|
+
_lastTextChannel: string | null
|
|
247
335
|
|
|
248
336
|
// Getters
|
|
249
337
|
get previous(): Track | null
|
|
250
338
|
get currenttrack(): Track | null
|
|
251
339
|
|
|
252
340
|
// Core Methods
|
|
253
|
-
|
|
341
|
+
/**
|
|
342
|
+
* Plays a track. If no track is provided, plays the next track in the queue.
|
|
343
|
+
* @param track The track to play
|
|
344
|
+
* @param options Options for playback
|
|
345
|
+
* @example
|
|
346
|
+
* ```ts
|
|
347
|
+
* // Play the next track in the queue
|
|
348
|
+
* await player.play();
|
|
349
|
+
*
|
|
350
|
+
* // Play a specific track
|
|
351
|
+
* await player.play(track);
|
|
352
|
+
* ```
|
|
353
|
+
*/
|
|
354
|
+
play(
|
|
355
|
+
track?: Track | null,
|
|
356
|
+
options?: { paused?: boolean; startTime?: number; noReplace?: boolean }
|
|
357
|
+
): Promise<Player>
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Connects the player to a voice channel
|
|
361
|
+
* @param options Connection options
|
|
362
|
+
* @example
|
|
363
|
+
* ```ts
|
|
364
|
+
* player.connect({
|
|
365
|
+
* guildId: '...',
|
|
366
|
+
* voiceChannel: '...',
|
|
367
|
+
* deaf: true
|
|
368
|
+
* });
|
|
369
|
+
* ```
|
|
370
|
+
*/
|
|
254
371
|
connect(options?: ConnectionOptions): Player
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Destroys the player and optionally cleans up resources
|
|
375
|
+
* @param options Destruction options
|
|
376
|
+
*/
|
|
255
377
|
destroy(options?: {
|
|
256
378
|
preserveClient?: boolean
|
|
257
379
|
skipRemote?: boolean
|
|
380
|
+
preserveMessage?: boolean
|
|
381
|
+
preserveReconnecting?: boolean
|
|
382
|
+
preserveTracks?: boolean
|
|
258
383
|
}): Player
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* Pauses or resumes the player
|
|
387
|
+
* @param paused Whether to pause
|
|
388
|
+
*/
|
|
259
389
|
pause(paused: boolean): Player
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Seeks to a position in the current track
|
|
393
|
+
* @param position Position in milliseconds
|
|
394
|
+
*/
|
|
260
395
|
seek(position: number): Player
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Stops the playback
|
|
399
|
+
*/
|
|
261
400
|
stop(): Player
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Sets the player volume
|
|
404
|
+
* @param volume Volume (0-1000)
|
|
405
|
+
*/
|
|
262
406
|
setVolume(volume: number): Player
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Sets the loop mode
|
|
410
|
+
* @param mode Loop mode (off, track, queue)
|
|
411
|
+
*/
|
|
263
412
|
setLoop(mode: LoopMode | LoopModeName): Player
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Sets the text channel for the player
|
|
416
|
+
* @param channel Channel ID
|
|
417
|
+
*/
|
|
264
418
|
setTextChannel(channel: string): Player
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Sets the voice channel and moves the player
|
|
422
|
+
* @param channel Channel ID
|
|
423
|
+
*/
|
|
265
424
|
setVoiceChannel(channel: string): Player
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* Disconnects the player from voice
|
|
428
|
+
*/
|
|
266
429
|
disconnect(): Player
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* Shuffles the queue
|
|
433
|
+
*/
|
|
267
434
|
shuffle(): Player
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* Gets the player queue
|
|
438
|
+
*/
|
|
268
439
|
getQueue(): Queue
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Replays the current track from the beginning
|
|
443
|
+
*/
|
|
269
444
|
replay(): Player
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* Skips the current track
|
|
448
|
+
*/
|
|
270
449
|
skip(): Player
|
|
271
450
|
|
|
272
451
|
// Advanced Methods
|
|
@@ -355,9 +534,24 @@ declare module 'aqualink' {
|
|
|
355
534
|
get thumbnail(): string
|
|
356
535
|
|
|
357
536
|
// Methods
|
|
537
|
+
/**
|
|
538
|
+
* Resolves local artwork/thumbnail
|
|
539
|
+
*/
|
|
358
540
|
resolveThumbnail(url?: string): string | null
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* Resolves the track if it needs (re)resolution
|
|
544
|
+
*/
|
|
359
545
|
resolve(aqua: Aqua, opts?: TrackResolutionOptions): Promise<Track | null>
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* Checks if the track is valid
|
|
549
|
+
*/
|
|
360
550
|
isValid(): boolean
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* Disposes the track and frees resources
|
|
554
|
+
*/
|
|
361
555
|
dispose(): void
|
|
362
556
|
|
|
363
557
|
// Internal Methods
|
|
@@ -380,13 +574,54 @@ declare module 'aqualink' {
|
|
|
380
574
|
useHttp2: boolean
|
|
381
575
|
|
|
382
576
|
// Core Methods
|
|
577
|
+
/**
|
|
578
|
+
* Sets the session ID for the REST connection
|
|
579
|
+
* @param sessionId The session ID
|
|
580
|
+
*/
|
|
383
581
|
setSessionId(sessionId: string): void
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* Makes a generic request to the Lavalink REST API
|
|
585
|
+
* @param method HTTP method
|
|
586
|
+
* @param endpoint API endpoint
|
|
587
|
+
* @param body Request body
|
|
588
|
+
*/
|
|
384
589
|
makeRequest(method: HttpMethod, endpoint: string, body?: any): Promise<any>
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* Updates a player via REST
|
|
593
|
+
* @param options Update options
|
|
594
|
+
*/
|
|
385
595
|
updatePlayer(options: UpdatePlayerOptions): Promise<any>
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* Destroys a player via REST
|
|
599
|
+
* @param guildId Guild ID
|
|
600
|
+
*/
|
|
386
601
|
destroyPlayer(guildId: string): Promise<any>
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Gets lyrics for a track
|
|
605
|
+
* @param options Lyrics options
|
|
606
|
+
*/
|
|
387
607
|
getLyrics(options: GetLyricsOptions): Promise<LyricsResponse>
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* Subscribes to live lyrics events
|
|
611
|
+
* @param guildId Guild ID
|
|
612
|
+
* @param sync Whether to sync with playback
|
|
613
|
+
*/
|
|
388
614
|
subscribeLiveLyrics(guildId: string, sync?: boolean): Promise<any>
|
|
615
|
+
|
|
616
|
+
/**
|
|
617
|
+
* Unsubscribes from live lyrics
|
|
618
|
+
* @param guildId Guild ID
|
|
619
|
+
*/
|
|
389
620
|
unsubscribeLiveLyrics(guildId: string): Promise<any>
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* Gets node statistics
|
|
624
|
+
*/
|
|
390
625
|
getStats(): Promise<NodeStats>
|
|
391
626
|
|
|
392
627
|
// Additional REST Methods
|
|
@@ -421,14 +656,33 @@ declare module 'aqualink' {
|
|
|
421
656
|
readonly last: Track | null
|
|
422
657
|
|
|
423
658
|
// Methods
|
|
659
|
+
/**
|
|
660
|
+
* Adds a track to the queue
|
|
661
|
+
* @param track Track to add
|
|
662
|
+
*/
|
|
424
663
|
add(track: Track): Queue
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* Adds multiple tracks to the queue
|
|
667
|
+
* @param tracks Tracks to add
|
|
668
|
+
*/
|
|
425
669
|
add(...tracks: Track[]): Queue
|
|
670
|
+
|
|
426
671
|
push(track: Track): number
|
|
427
672
|
unshift(track: Track): number
|
|
428
673
|
shift(): Track | undefined
|
|
429
674
|
remove(track: Track): boolean
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* Clears the queue
|
|
678
|
+
*/
|
|
430
679
|
clear(): void
|
|
680
|
+
|
|
681
|
+
/**
|
|
682
|
+
* Shuffles the queue
|
|
683
|
+
*/
|
|
431
684
|
shuffle(): Queue
|
|
685
|
+
|
|
432
686
|
peek(): Track | null
|
|
433
687
|
isEmpty(): boolean
|
|
434
688
|
toArray(): Track[]
|
|
@@ -509,6 +763,10 @@ declare module 'aqualink' {
|
|
|
509
763
|
_updateTimer: NodeJS.Timeout | null
|
|
510
764
|
_hasDebugListeners: boolean
|
|
511
765
|
_hasMoveListeners: boolean
|
|
766
|
+
_lastSentVoiceKey: string
|
|
767
|
+
_lastVoiceDataUpdate: number
|
|
768
|
+
_stateFlags: number
|
|
769
|
+
_regionMigrationAttempted: boolean
|
|
512
770
|
|
|
513
771
|
// Methods
|
|
514
772
|
setServerUpdate(data: VoiceServerUpdate['d']): void
|
|
@@ -525,6 +783,7 @@ declare module 'aqualink' {
|
|
|
525
783
|
_sendUpdate(payload: any): Promise<void>
|
|
526
784
|
_handleDisconnect(): void
|
|
527
785
|
_clearPendingUpdate(): void
|
|
786
|
+
_checkRegionMigration(): void
|
|
528
787
|
}
|
|
529
788
|
|
|
530
789
|
export class Plugin {
|
|
@@ -576,6 +835,9 @@ declare module 'aqualink' {
|
|
|
576
835
|
loadBalancer?: LoadBalancerStrategy
|
|
577
836
|
failoverOptions?: FailoverOptions
|
|
578
837
|
useHttp2?: boolean
|
|
838
|
+
autoRegionMigrate?: boolean
|
|
839
|
+
debugTrace?: boolean
|
|
840
|
+
traceMaxEntries?: number
|
|
579
841
|
}
|
|
580
842
|
|
|
581
843
|
export interface FailoverOptions {
|
|
@@ -595,7 +857,7 @@ declare module 'aqualink' {
|
|
|
595
857
|
auth?: string
|
|
596
858
|
ssl?: boolean
|
|
597
859
|
sessionId?: string
|
|
598
|
-
regions?:
|
|
860
|
+
regions?: DiscordVoiceRegion[]
|
|
599
861
|
}
|
|
600
862
|
|
|
601
863
|
export interface NodeAdditionalOptions {
|
|
@@ -626,7 +888,7 @@ declare module 'aqualink' {
|
|
|
626
888
|
deaf?: boolean
|
|
627
889
|
mute?: boolean
|
|
628
890
|
defaultVolume?: number
|
|
629
|
-
region?:
|
|
891
|
+
region?: DiscordVoiceRegion
|
|
630
892
|
}
|
|
631
893
|
|
|
632
894
|
export interface ResolveOptions {
|
|
@@ -923,6 +1185,122 @@ declare module 'aqualink' {
|
|
|
923
1185
|
toFront?: boolean
|
|
924
1186
|
}
|
|
925
1187
|
|
|
1188
|
+
/**
|
|
1189
|
+
* A map of Discord voice region codes to their string values.
|
|
1190
|
+
* Each entry shows the country and airport name in IntelliSense.
|
|
1191
|
+
*
|
|
1192
|
+
* Use `VoiceRegion.bom`, `VoiceRegion.gru`, etc. for full autocomplete descriptions,
|
|
1193
|
+
* or pass raw strings like `'bom'` directly — both are accepted by `NodeOptions.regions`.
|
|
1194
|
+
*
|
|
1195
|
+
* @example
|
|
1196
|
+
* ```ts
|
|
1197
|
+
* // With descriptions in IntelliSense
|
|
1198
|
+
* { host: '...', regions: [VoiceRegion.gru, VoiceRegion.eze] }
|
|
1199
|
+
*
|
|
1200
|
+
* // Raw strings also work
|
|
1201
|
+
* { host: '...', regions: ['gru', 'eze'] }
|
|
1202
|
+
* ```
|
|
1203
|
+
*/
|
|
1204
|
+
export const VoiceRegion: {
|
|
1205
|
+
// ─── Asia Pacific ─────────────────────────────────────────────────────────
|
|
1206
|
+
|
|
1207
|
+
/** 🇮🇳 Mumbai Chhatrapati Shivaji Maharaj International */
|
|
1208
|
+
readonly India: 'bom'
|
|
1209
|
+
/** 🇸🇬 Changi Airport */
|
|
1210
|
+
readonly Singapore: 'sin'
|
|
1211
|
+
/** 🇯🇵 Tokyo Narita International */
|
|
1212
|
+
readonly Japan: 'nrt'
|
|
1213
|
+
/** 🇰🇷 Seoul Incheon International */
|
|
1214
|
+
readonly SouthKorea: 'icn'
|
|
1215
|
+
/** 🇭🇰 Hong Kong International */
|
|
1216
|
+
readonly HongKong: 'hkg'
|
|
1217
|
+
/** 🇦🇺 Sydney Kingsford Smith */
|
|
1218
|
+
readonly Australia: 'syd'
|
|
1219
|
+
/** 🇮🇩 Jakarta Soekarno-Hatta International */
|
|
1220
|
+
readonly Indonesia: 'cgk'
|
|
1221
|
+
|
|
1222
|
+
// ─── Europe ───────────────────────────────────────────────────────────────
|
|
1223
|
+
|
|
1224
|
+
/** 🇩🇪 Frankfurt Airport */
|
|
1225
|
+
readonly Germany: 'fra'
|
|
1226
|
+
/** 🇳🇱 Amsterdam Schiphol */
|
|
1227
|
+
readonly Netherlands: 'ams'
|
|
1228
|
+
/** 🇬🇧 London Heathrow */
|
|
1229
|
+
readonly UnitedKingdom: 'lhr'
|
|
1230
|
+
/** 🇫🇷 Paris Charles de Gaulle */
|
|
1231
|
+
readonly France: 'cdg'
|
|
1232
|
+
/** 🇪🇸 Madrid Barajas */
|
|
1233
|
+
readonly Spain: 'mad'
|
|
1234
|
+
/** 🇮🇹 Milan Malpensa */
|
|
1235
|
+
readonly Italy: 'mxp'
|
|
1236
|
+
/** 🇸🇪 Stockholm Arlanda */
|
|
1237
|
+
readonly Sweden: 'arn'
|
|
1238
|
+
/** 🇫🇮 Helsinki Vantaa */
|
|
1239
|
+
readonly Finland: 'hel'
|
|
1240
|
+
/** 🇵🇱 Warsaw Chopin */
|
|
1241
|
+
readonly Poland: 'waw'
|
|
1242
|
+
/** 🇷🇴 Bucharest Henri Coanda */
|
|
1243
|
+
readonly Romania: 'buh'
|
|
1244
|
+
/** 🇷🇺 St. Petersburg Pulkovo */
|
|
1245
|
+
readonly RussiaSTP: 'led'
|
|
1246
|
+
/** 🇷🇺 Moscow Sheremetyevo */
|
|
1247
|
+
readonly RussiaMoscow: 'svo'
|
|
1248
|
+
|
|
1249
|
+
// ─── Middle East & Africa ─────────────────────────────────────────────────
|
|
1250
|
+
|
|
1251
|
+
/** 🇮🇱 Tel Aviv Ben Gurion */
|
|
1252
|
+
readonly Israel: 'tlv'
|
|
1253
|
+
/** 🇦🇪 Dubai International */
|
|
1254
|
+
readonly UAE: 'dxb'
|
|
1255
|
+
/** 🇸🇦 Dammam King Fahd International */
|
|
1256
|
+
readonly SaudiArabia: 'dmm'
|
|
1257
|
+
/** 🇿🇦 Johannesburg O.R. Tambo International */
|
|
1258
|
+
readonly SouthAfrica: 'jnb'
|
|
1259
|
+
|
|
1260
|
+
// ─── North America ────────────────────────────────────────────────────────
|
|
1261
|
+
|
|
1262
|
+
/** 🇺🇸 Newark / New York */
|
|
1263
|
+
readonly USANewark: 'ewr'
|
|
1264
|
+
/** 🇺🇸 Washington D.C. Dulles */
|
|
1265
|
+
readonly USAWashington: 'iad'
|
|
1266
|
+
/** 🇺🇸 Atlanta Hartsfield-Jackson */
|
|
1267
|
+
readonly USAAtlanta: 'atl'
|
|
1268
|
+
/** 🇺🇸 Miami International */
|
|
1269
|
+
readonly USAMiami: 'mia'
|
|
1270
|
+
/** 🇺🇸 Chicago O'Hare */
|
|
1271
|
+
readonly USAChicago: 'ord'
|
|
1272
|
+
/** 🇺🇸 Dallas/Fort Worth */
|
|
1273
|
+
readonly USADallas: 'dfw'
|
|
1274
|
+
/** 🇺🇸 Seattle-Tacoma / Oregon */
|
|
1275
|
+
readonly USASeattle: 'sea'
|
|
1276
|
+
/** 🇺🇸 Los Angeles International */
|
|
1277
|
+
readonly USALosAngeles: 'lax'
|
|
1278
|
+
/** 🇨🇦 Toronto Pearson International */
|
|
1279
|
+
readonly CanadaToronto: 'yyz'
|
|
1280
|
+
/** 🇨🇦 Montreal Pierre Elliott Trudeau */
|
|
1281
|
+
readonly CanadaMontreal: 'ymq'
|
|
1282
|
+
|
|
1283
|
+
// ─── South America ────────────────────────────────────────────────────────
|
|
1284
|
+
|
|
1285
|
+
/** 🇧🇷 Sao Paulo Guarulhos International */
|
|
1286
|
+
readonly Brazil: 'gru'
|
|
1287
|
+
/** 🇨🇱 Santiago Arturo Merino Benitez */
|
|
1288
|
+
readonly Chile: 'scl'
|
|
1289
|
+
/** 🇦🇷 Buenos Aires Ministro Pistarini */
|
|
1290
|
+
readonly Argentina: 'eze'
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
/**
|
|
1294
|
+
* Discord voice server region prefix (derived from IATA airport codes).
|
|
1295
|
+
* Used in `NodeOptions.regions` to match players to the best Lavalink node
|
|
1296
|
+
* based on Discord's voice endpoint (e.g. `c-bom06-xxxx.discord.media` -> `'bom'`).
|
|
1297
|
+
*
|
|
1298
|
+
* For descriptions on each value, use the `VoiceRegion` object in your IDE.
|
|
1299
|
+
*/
|
|
1300
|
+
export type DiscordVoiceRegion =
|
|
1301
|
+
| (typeof VoiceRegion)[keyof typeof VoiceRegion]
|
|
1302
|
+
| (string & {})
|
|
1303
|
+
|
|
926
1304
|
// Type Unions and Enums
|
|
927
1305
|
export type SearchSource =
|
|
928
1306
|
| 'ytsearch'
|
package/build/index.js
CHANGED
|
@@ -9,6 +9,53 @@ const Rest = require('./structures/Rest')
|
|
|
9
9
|
const Track = require('./structures/Track')
|
|
10
10
|
const { AqualinkEvents } = require('./structures/AqualinkEvents')
|
|
11
11
|
|
|
12
|
+
const VoiceRegion = Object.freeze({
|
|
13
|
+
// ─── Asia Pacific ─────────────────────────────────────────────────────────
|
|
14
|
+
India: 'bom',
|
|
15
|
+
Singapore: 'sin',
|
|
16
|
+
Japan: 'nrt',
|
|
17
|
+
SouthKorea: 'icn',
|
|
18
|
+
HongKong: 'hkg',
|
|
19
|
+
Australia: 'syd',
|
|
20
|
+
Indonesia: 'cgk',
|
|
21
|
+
|
|
22
|
+
// ─── Europe ───────────────────────────────────────────────────────────────
|
|
23
|
+
Germany: 'fra',
|
|
24
|
+
Netherlands: 'ams',
|
|
25
|
+
UnitedKingdom: 'lhr',
|
|
26
|
+
France: 'cdg',
|
|
27
|
+
Spain: 'mad',
|
|
28
|
+
Italy: 'mxp',
|
|
29
|
+
Sweden: 'arn',
|
|
30
|
+
Finland: 'hel',
|
|
31
|
+
Poland: 'waw',
|
|
32
|
+
Romania: 'buh',
|
|
33
|
+
RussiaSTP: 'led',
|
|
34
|
+
RussiaMoscow: 'svo',
|
|
35
|
+
|
|
36
|
+
// ─── Middle East & Africa ─────────────────────────────────────────────────
|
|
37
|
+
Israel: 'tlv',
|
|
38
|
+
UAE: 'dxb',
|
|
39
|
+
SaudiArabia: 'dmm',
|
|
40
|
+
SouthAfrica: 'jnb',
|
|
41
|
+
|
|
42
|
+
// ─── North America ────────────────────────────────────────────────────────
|
|
43
|
+
USANewark: 'ewr',
|
|
44
|
+
USAWashington: 'iad',
|
|
45
|
+
USAAtlanta: 'atl',
|
|
46
|
+
USAMiami: 'mia',
|
|
47
|
+
USAChicago: 'ord',
|
|
48
|
+
USADallas: 'dfw',
|
|
49
|
+
USASeattle: 'sea',
|
|
50
|
+
USALosAngeles: 'lax',
|
|
51
|
+
CanadaToronto: 'yyz',
|
|
52
|
+
CanadaMontreal: 'ymq',
|
|
53
|
+
|
|
54
|
+
Brazil: 'gru' || 'brazil', // i only know this endpoint lol.
|
|
55
|
+
Chile: 'scl' || 'chile',
|
|
56
|
+
Argentina: 'eze' || 'argentina'
|
|
57
|
+
})
|
|
58
|
+
|
|
12
59
|
module.exports = {
|
|
13
60
|
Connection,
|
|
14
61
|
Filters,
|
|
@@ -19,5 +66,6 @@ module.exports = {
|
|
|
19
66
|
Queue,
|
|
20
67
|
Rest,
|
|
21
68
|
Track,
|
|
69
|
+
VoiceRegion,
|
|
22
70
|
AqualinkEvents
|
|
23
71
|
}
|