lavalink-client 2.5.6 → 2.5.8

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 (98) hide show
  1. package/README.md +9 -2
  2. package/dist/index.d.mts +3036 -0
  3. package/dist/index.d.ts +3036 -0
  4. package/dist/index.js +4965 -0
  5. package/dist/index.mjs +4904 -0
  6. package/package.json +22 -25
  7. package/dist/cjs/index.d.ts +0 -16
  8. package/dist/cjs/index.js +0 -19
  9. package/dist/cjs/package.json +0 -3
  10. package/dist/cjs/structures/Constants.d.ts +0 -90
  11. package/dist/cjs/structures/Constants.js +0 -296
  12. package/dist/cjs/structures/CustomSearches/BandCampSearch.d.ts +0 -3
  13. package/dist/cjs/structures/CustomSearches/BandCampSearch.js +0 -39
  14. package/dist/cjs/structures/Filters.d.ts +0 -169
  15. package/dist/cjs/structures/Filters.js +0 -700
  16. package/dist/cjs/structures/LavalinkManager.d.ts +0 -232
  17. package/dist/cjs/structures/LavalinkManager.js +0 -621
  18. package/dist/cjs/structures/LavalinkManagerStatics.d.ts +0 -15
  19. package/dist/cjs/structures/LavalinkManagerStatics.js +0 -149
  20. package/dist/cjs/structures/Node.d.ts +0 -523
  21. package/dist/cjs/structures/Node.js +0 -1605
  22. package/dist/cjs/structures/NodeManager.d.ts +0 -100
  23. package/dist/cjs/structures/NodeManager.js +0 -224
  24. package/dist/cjs/structures/Player.d.ts +0 -223
  25. package/dist/cjs/structures/Player.js +0 -807
  26. package/dist/cjs/structures/Queue.d.ts +0 -186
  27. package/dist/cjs/structures/Queue.js +0 -390
  28. package/dist/cjs/structures/Types/Filters.d.ts +0 -190
  29. package/dist/cjs/structures/Types/Filters.js +0 -2
  30. package/dist/cjs/structures/Types/Manager.d.ts +0 -271
  31. package/dist/cjs/structures/Types/Manager.js +0 -2
  32. package/dist/cjs/structures/Types/Node.d.ts +0 -238
  33. package/dist/cjs/structures/Types/Node.js +0 -2
  34. package/dist/cjs/structures/Types/Player.d.ts +0 -114
  35. package/dist/cjs/structures/Types/Player.js +0 -2
  36. package/dist/cjs/structures/Types/Queue.d.ts +0 -34
  37. package/dist/cjs/structures/Types/Queue.js +0 -2
  38. package/dist/cjs/structures/Types/Track.d.ts +0 -134
  39. package/dist/cjs/structures/Types/Track.js +0 -2
  40. package/dist/cjs/structures/Types/Utils.d.ts +0 -440
  41. package/dist/cjs/structures/Types/Utils.js +0 -2
  42. package/dist/cjs/structures/Utils.d.ts +0 -116
  43. package/dist/cjs/structures/Utils.js +0 -567
  44. package/dist/esm/index.d.ts +0 -16
  45. package/dist/esm/index.js +0 -16
  46. package/dist/esm/package.json +0 -3
  47. package/dist/esm/structures/Constants.d.ts +0 -90
  48. package/dist/esm/structures/Constants.js +0 -293
  49. package/dist/esm/structures/CustomSearches/BandCampSearch.d.ts +0 -3
  50. package/dist/esm/structures/CustomSearches/BandCampSearch.js +0 -35
  51. package/dist/esm/structures/Filters.d.ts +0 -169
  52. package/dist/esm/structures/Filters.js +0 -696
  53. package/dist/esm/structures/LavalinkManager.d.ts +0 -232
  54. package/dist/esm/structures/LavalinkManager.js +0 -617
  55. package/dist/esm/structures/LavalinkManagerStatics.d.ts +0 -15
  56. package/dist/esm/structures/LavalinkManagerStatics.js +0 -146
  57. package/dist/esm/structures/Node.d.ts +0 -523
  58. package/dist/esm/structures/Node.js +0 -1600
  59. package/dist/esm/structures/NodeManager.d.ts +0 -100
  60. package/dist/esm/structures/NodeManager.js +0 -220
  61. package/dist/esm/structures/Player.d.ts +0 -223
  62. package/dist/esm/structures/Player.js +0 -803
  63. package/dist/esm/structures/Queue.d.ts +0 -186
  64. package/dist/esm/structures/Queue.js +0 -384
  65. package/dist/esm/structures/Types/Filters.d.ts +0 -190
  66. package/dist/esm/structures/Types/Filters.js +0 -1
  67. package/dist/esm/structures/Types/Manager.d.ts +0 -271
  68. package/dist/esm/structures/Types/Manager.js +0 -1
  69. package/dist/esm/structures/Types/Node.d.ts +0 -238
  70. package/dist/esm/structures/Types/Node.js +0 -1
  71. package/dist/esm/structures/Types/Player.d.ts +0 -114
  72. package/dist/esm/structures/Types/Player.js +0 -1
  73. package/dist/esm/structures/Types/Queue.d.ts +0 -34
  74. package/dist/esm/structures/Types/Queue.js +0 -1
  75. package/dist/esm/structures/Types/Track.d.ts +0 -134
  76. package/dist/esm/structures/Types/Track.js +0 -1
  77. package/dist/esm/structures/Types/Utils.d.ts +0 -440
  78. package/dist/esm/structures/Types/Utils.js +0 -1
  79. package/dist/esm/structures/Utils.d.ts +0 -116
  80. package/dist/esm/structures/Utils.js +0 -559
  81. package/dist/types/index.d.ts +0 -16
  82. package/dist/types/structures/Constants.d.ts +0 -90
  83. package/dist/types/structures/CustomSearches/BandCampSearch.d.ts +0 -3
  84. package/dist/types/structures/Filters.d.ts +0 -169
  85. package/dist/types/structures/LavalinkManager.d.ts +0 -232
  86. package/dist/types/structures/LavalinkManagerStatics.d.ts +0 -15
  87. package/dist/types/structures/Node.d.ts +0 -523
  88. package/dist/types/structures/NodeManager.d.ts +0 -100
  89. package/dist/types/structures/Player.d.ts +0 -223
  90. package/dist/types/structures/Queue.d.ts +0 -186
  91. package/dist/types/structures/Types/Filters.d.ts +0 -190
  92. package/dist/types/structures/Types/Manager.d.ts +0 -271
  93. package/dist/types/structures/Types/Node.d.ts +0 -238
  94. package/dist/types/structures/Types/Player.d.ts +0 -114
  95. package/dist/types/structures/Types/Queue.d.ts +0 -34
  96. package/dist/types/structures/Types/Track.d.ts +0 -134
  97. package/dist/types/structures/Types/Utils.d.ts +0 -440
  98. package/dist/types/structures/Utils.d.ts +0 -116
@@ -1,149 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SourceLinksRegexes = exports.LavalinkPlugins = exports.DefaultSources = void 0;
4
- /** Default Sources Record, to allow source parsing with multiple inputs. */
5
- exports.DefaultSources = {
6
- // youtubemusic
7
- "youtube music": "ytmsearch",
8
- "youtubemusic": "ytmsearch",
9
- "ytmsearch": "ytmsearch",
10
- "ytm": "ytmsearch",
11
- "musicyoutube": "ytmsearch",
12
- "music youtube": "ytmsearch",
13
- // youtube
14
- "youtube": "ytsearch",
15
- "yt": "ytsearch",
16
- "ytsearch": "ytsearch",
17
- // soundcloud
18
- "soundcloud": "scsearch",
19
- "scsearch": "scsearch",
20
- "sc": "scsearch",
21
- // apple music
22
- "apple music": "amsearch",
23
- "apple": "amsearch",
24
- "applemusic": "amsearch",
25
- "amsearch": "amsearch",
26
- "am": "amsearch",
27
- "musicapple": "amsearch",
28
- "music apple": "amsearch",
29
- // spotify
30
- "spotify": "spsearch",
31
- "spsearch": "spsearch",
32
- "sp": "spsearch",
33
- "spotify.com": "spsearch",
34
- "spotifycom": "spsearch",
35
- "sprec": "sprec",
36
- "spsuggestion": "sprec",
37
- // deezer
38
- "deezer": "dzsearch",
39
- "dz": "dzsearch",
40
- "dzsearch": "dzsearch",
41
- "dzisrc": "dzisrc",
42
- "dzrec": "dzrec",
43
- // yandexmusic
44
- "yandex music": "ymsearch",
45
- "yandexmusic": "ymsearch",
46
- "yandex": "ymsearch",
47
- "ymsearch": "ymsearch",
48
- "ymrec": "ymrec",
49
- // VK Music (lavasrc)
50
- "vksearch": "vksearch",
51
- "vkmusic": "vksearch",
52
- "vk music": "vksearch",
53
- "vkrec": "vkrec",
54
- "vk": "vksearch",
55
- // Qobuz (lavasrc)
56
- "qbsearch": "qbsearch",
57
- "qobuz": "qbsearch",
58
- "qbisrc": "qbisrc",
59
- "qbrec": "qbrec",
60
- // speak PLUGIN
61
- "speak": "speak",
62
- "tts": "tts",
63
- "ftts": "ftts",
64
- "flowery": "ftts",
65
- "flowery.tts": "ftts",
66
- "flowerytts": "ftts",
67
- // Client sided search platforms (after lavalinkv4.0.6 it will search via bcsearch on the node itself)
68
- "bandcamp": "bcsearch",
69
- "bc": "bcsearch",
70
- "bcsearch": "bcsearch",
71
- // other searches:
72
- "phsearch": "phsearch",
73
- "pornhub": "phsearch",
74
- "porn": "phsearch",
75
- // local files
76
- "local": "local",
77
- // http requests
78
- "http": "http",
79
- "https": "https",
80
- "link": "link",
81
- "uri": "uri",
82
- // tidal
83
- "tidal": "tdsearch",
84
- "td": "tdsearch",
85
- "tidal music": "tdsearch",
86
- "tdsearch": "tdsearch",
87
- "tdrec": "tdrec",
88
- // jiosaavn
89
- "jiosaavn": "jssearch",
90
- "js": "jssearch",
91
- "jssearch": "jssearch",
92
- "jsrec": "jsrec"
93
- };
94
- /** Lavalink Plugins definiton */
95
- exports.LavalinkPlugins = {
96
- DuncteBot_Plugin: "DuncteBot-plugin",
97
- LavaSrc: "lavasrc-plugin",
98
- GoogleCloudTTS: "tts-plugin",
99
- LavaSearch: "lavasearch-plugin",
100
- Jiosaavn_Plugin: "jiosaavn-plugin",
101
- LavalinkFilterPlugin: "lavalink-filter-plugin",
102
- JavaTimedLyricsPlugin: "java-lyrics-plugin"
103
- };
104
- /** Lavalink Sources regexes for url validations */
105
- exports.SourceLinksRegexes = {
106
- /** DEFAULT SUPPORTED BY LAVALINK */
107
- YoutubeRegex: /https?:\/\/?(?:www\.)?(?:(m|www)\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|shorts|playlist\?|watch\?v=|watch\?.+(?:&|&);v=))([a-zA-Z0-9\-_]{11})?(?:(?:\?|&|&)index=((?:\d){1,3}))?(?:(?:\?|&|&)?list=([a-zA-Z\-_0-9]{34}))?(?:\S+)?/,
108
- YoutubeMusicRegex: /https?:\/\/?(?:www\.)?(?:(music|m|www)\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|shorts|playlist\?|watch\?v=|watch\?.+(?:&|&);v=))([a-zA-Z0-9\-_]{11})?(?:(?:\?|&|&)index=((?:\d){1,3}))?(?:(?:\?|&|&)?list=([a-zA-Z\-_0-9]{34}))?(?:\S+)?/,
109
- SoundCloudRegex: /https:\/\/(?:on\.)?soundcloud\.com\//,
110
- SoundCloudMobileRegex: /https?:\/\/(soundcloud\.app\.goo\.gl)\/(\S+)/,
111
- bandcamp: /https?:\/\/?(?:www\.)?([\d|\w]+)\.bandcamp\.com\/(\S+)/,
112
- TwitchTv: /https?:\/\/?(?:www\.)?twitch\.tv\/\w+/,
113
- vimeo: /https?:\/\/(www\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|)(\d+)(?:|\/\?)/,
114
- mp3Url: /(https?|ftp|file):\/\/(www.)?(.*?)\.(mp3)$/,
115
- m3uUrl: /(https?|ftp|file):\/\/(www.)?(.*?)\.(m3u)$/,
116
- m3u8Url: /(https?|ftp|file):\/\/(www.)?(.*?)\.(m3u8)$/,
117
- mp4Url: /(https?|ftp|file):\/\/(www.)?(.*?)\.(mp4)$/,
118
- m4aUrl: /(https?|ftp|file):\/\/(www.)?(.*?)\.(m4a)$/,
119
- wavUrl: /(https?|ftp|file):\/\/(www.)?(.*?)\.(wav)$/,
120
- aacpUrl: /(https?|ftp|file):\/\/(www.)?(.*?)\.(aacp)$/,
121
- /** FROM LAVA SOURCE */
122
- DeezerTrackRegex: /(https?:\/\/|)?(?:www\.)?deezer\.com\/(?:\w{2}\/)?track\/(\d+)/,
123
- DeezerPageLinkRegex: /(https?:\/\/|)?(?:www\.)?deezer\.page\.link\/(\S+)/,
124
- DeezerPlaylistRegex: /(https?:\/\/|)?(?:www\.)?deezer\.com\/(?:\w{2}\/)?playlist\/(\d+)/,
125
- DeezerAlbumRegex: /(https?:\/\/|)?(?:www\.)?deezer\.com\/(?:\w{2}\/)?album\/(\d+)/,
126
- DeezerArtistRegex: /(https?:\/\/|)?(?:www\.)?deezer\.com\/(?:\w{2}\/)?artist\/(\d+)/,
127
- DeezerMixesRegex: /(https?:\/\/|)?(?:www\.)?deezer\.com\/(?:\w{2}\/)?mixes\/genre\/(\d+)/,
128
- DeezerEpisodeRegex: /(https?:\/\/|)?(?:www\.)?deezer\.com\/(?:\w{2}\/)?episode\/(\d+)/,
129
- // DeezerPodcastRegex: /(https?:\/\/|)?(?:www\.)?deezer\.com\/(?:\w{2}\/)?podcast\/(\d+)/,
130
- AllDeezerRegexWithoutPageLink: /(https?:\/\/|)?(?:www\.)?deezer\.com\/(?:\w{2}\/)?(track|playlist|album|artist|mixes\/genre|episode)\/(\d+)/,
131
- AllDeezerRegex: /((https?:\/\/|)?(?:www\.)?deezer\.com\/(?:\w{2}\/)?(track|playlist|album|artist|mixes\/genre|episode)\/(\d+)|(https?:\/\/|)?(?:www\.)?deezer\.page\.link\/(\S+))/,
132
- SpotifySongRegex: /(https?:\/\/)(www\.)?open\.spotify\.com\/((?<region>[a-zA-Z-]+)\/)?(user\/(?<user>[a-zA-Z0-9-_]+)\/)?track\/(?<identifier>[a-zA-Z0-9-_]+)/,
133
- SpotifyPlaylistRegex: /(https?:\/\/)(www\.)?open\.spotify\.com\/((?<region>[a-zA-Z-]+)\/)?(user\/(?<user>[a-zA-Z0-9-_]+)\/)?playlist\/(?<identifier>[a-zA-Z0-9-_]+)/,
134
- SpotifyArtistRegex: /(https?:\/\/)(www\.)?open\.spotify\.com\/((?<region>[a-zA-Z-]+)\/)?(user\/(?<user>[a-zA-Z0-9-_]+)\/)?artist\/(?<identifier>[a-zA-Z0-9-_]+)/,
135
- SpotifyEpisodeRegex: /(https?:\/\/)(www\.)?open\.spotify\.com\/((?<region>[a-zA-Z-]+)\/)?(user\/(?<user>[a-zA-Z0-9-_]+)\/)?episode\/(?<identifier>[a-zA-Z0-9-_]+)/,
136
- SpotifyShowRegex: /(https?:\/\/)(www\.)?open\.spotify\.com\/((?<region>[a-zA-Z-]+)\/)?(user\/(?<user>[a-zA-Z0-9-_]+)\/)?show\/(?<identifier>[a-zA-Z0-9-_]+)/,
137
- SpotifyAlbumRegex: /(https?:\/\/)(www\.)?open\.spotify\.com\/((?<region>[a-zA-Z-]+)\/)?(user\/(?<user>[a-zA-Z0-9-_]+)\/)?album\/(?<identifier>[a-zA-Z0-9-_]+)/,
138
- AllSpotifyRegex: /(https?:\/\/)(www\.)?open\.spotify\.com\/((?<region>[a-zA-Z-]+)\/)?(user\/(?<user>[a-zA-Z0-9-_]+)\/)?(?<type>track|album|playlist|artist|episode|show)\/(?<identifier>[a-zA-Z0-9-_]+)/,
139
- appleMusic: /https?:\/\/?(?:www\.)?music\.apple\.com\/(\S+)/,
140
- /** From tidal */
141
- tidal: /https?:\/\/?(?:www\.)?(?:tidal|listen)\.tidal\.com\/(?<type>track|album|playlist|artist)\/(?<identifier>[a-zA-Z0-9-_]+)/,
142
- /** From jiosaavn-plugin */
143
- jiosaavn: /(https?:\/\/)(www\.)?jiosaavn\.com\/(?<type>song|album|featured|artist)\/([a-zA-Z0-9-_/,]+)/,
144
- /** FROM DUNCTE BOT PLUGIN */
145
- tiktok: /https:\/\/www\.tiktok\.com\//,
146
- mixcloud: /https:\/\/www\.mixcloud\.com\//,
147
- musicYandex: /https:\/\/music\.yandex\.ru\//,
148
- radiohost: /https?:\/\/[^.\s]+\.radiohost\.de\/(\S+)/,
149
- };
@@ -1,523 +0,0 @@
1
- import type { Base64, InvalidLavalinkRestRequest, LavalinkPlayer, LavaSearchQuery, LavaSearchResponse, PlayerUpdateInfo, RoutePlanner, SearchQuery, SearchResult, Session } from "./Types/Utils.js";
2
- import type { Player } from "./Player.js";
3
- import type { DestroyReasonsType, DisconnectReasonsType } from "./Types/Player.js";
4
- import type { Track } from "./Types/Track.js";
5
- import type { NodeManager } from "./NodeManager.js";
6
- import type { BaseNodeStats, LavalinkInfo, LavalinkNodeOptions, LyricsResult, ModifyRequest, NodeStats, SponsorBlockSegment } from "./Types/Node.js";
7
- /**
8
- * Lavalink Node creator class
9
- */
10
- export declare class LavalinkNode {
11
- private heartBeatPingTimestamp;
12
- private heartBeatPongTimestamp;
13
- get heartBeatPing(): number;
14
- private heartBeatInterval?;
15
- private pingTimeout?;
16
- isAlive: boolean;
17
- /** The provided Options of the Node */
18
- options: LavalinkNodeOptions;
19
- /** The amount of rest calls the node has made. */
20
- calls: number;
21
- /** Stats from lavalink, will be updated via an interval by lavalink. */
22
- stats: NodeStats;
23
- /** The current sessionId, only present when connected */
24
- sessionId?: string | null;
25
- /** Wether the node resuming is enabled or not */
26
- resuming: {
27
- enabled: boolean;
28
- timeout: number | null;
29
- };
30
- /** Actual Lavalink Information of the Node */
31
- info: LavalinkInfo | null;
32
- /** The Node Manager of this Node */
33
- private NodeManager;
34
- /** The Reconnection Timeout */
35
- private reconnectTimeout?;
36
- /** The Reconnection Attempt counter */
37
- private reconnectAttempts;
38
- /** The Socket of the Lavalink */
39
- private socket;
40
- /** Version of what the Lavalink Server should be */
41
- private version;
42
- /**
43
- * Create a new Node
44
- * @param options Lavalink Node Options
45
- * @param manager Node Manager
46
- *
47
- *
48
- * @example
49
- * ```ts
50
- * // don't create a node manually, instead use:
51
- *
52
- * client.lavalink.nodeManager.createNode(options)
53
- * ```
54
- */
55
- constructor(options: LavalinkNodeOptions, manager: NodeManager);
56
- /**
57
- * Raw Request util function
58
- * @param endpoint endpoint string
59
- * @param modify modify the request
60
- * @param extraQueryUrlParams UrlSearchParams to use in a encodedURI, useful for example for flowertts
61
- * @returns object containing request and option information
62
- *
63
- * @example
64
- * ```ts
65
- * player.node.rawRequest(`/loadtracks?identifier=Never gonna give you up`, (options) => options.method = "GET");
66
- * ```
67
- */
68
- private rawRequest;
69
- /**
70
- * Makes an API call to the Node. Should only be used for manual parsing like for not supported plugins
71
- * @param endpoint The endpoint that we will make the call to
72
- * @param modify Used to modify the request before being sent
73
- * @returns The returned data
74
- *
75
- * @example
76
- * ```ts
77
- * player.node.request(`/loadtracks?identifier=Never gonna give you up`, (options) => options.method = "GET", false);
78
- * ```
79
- */
80
- request(endpoint: string, modify: ModifyRequest | undefined, parseAsText: true): Promise<string>;
81
- request(endpoint: string, modify?: ModifyRequest, parseAsText?: false): Promise<any>;
82
- /**
83
- * Search something raw on the node, please note only add tracks to players of that node
84
- * @param query SearchQuery Object
85
- * @param requestUser Request User for creating the player(s)
86
- * @param throwOnEmpty Wether to throw on an empty result or not
87
- * @returns Searchresult
88
- *
89
- * @example
90
- * ```ts
91
- * // use player.search() instead
92
- * player.node.search({ query: "Never gonna give you up by Rick Astley", source: "soundcloud" }, interaction.user);
93
- * player.node.search({ query: "https://deezer.com/track/123456789" }, interaction.user);
94
- * ```
95
- */
96
- search(query: SearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<SearchResult>;
97
- /**
98
- * Search something using the lavaSearchPlugin (filtered searches by types)
99
- * @param query LavaSearchQuery Object
100
- * @param requestUser Request User for creating the player(s)
101
- * @param throwOnEmpty Wether to throw on an empty result or not
102
- * @returns LavaSearchresult (SearchResult if link is provided)
103
- *
104
- * @example
105
- * ```ts
106
- * // use player.search() instead
107
- * player.node.lavaSearch({ types: ["playlist", "album"], query: "Rick Astley", source: "spotify" }, interaction.user);
108
- * ```
109
- */
110
- lavaSearch(query: LavaSearchQuery, requestUser: unknown, throwOnEmpty?: boolean): Promise<LavaSearchResponse | SearchResult>;
111
- /**
112
- * Update the Player State on the Lavalink Server
113
- * @param data data to send to lavalink and sync locally
114
- * @returns result from lavalink
115
- *
116
- * @example
117
- * ```ts
118
- * // use player.search() instead
119
- * player.node.updatePlayer({ guildId: player.guildId, playerOptions: { paused: true } }); // example to pause it
120
- * ```
121
- */
122
- updatePlayer(data: PlayerUpdateInfo): Promise<LavalinkPlayer>;
123
- /**
124
- * Destroys the Player on the Lavalink Server
125
- * @param guildId
126
- * @returns request result
127
- *
128
- * @example
129
- * ```ts
130
- * // use player.destroy() instead
131
- * player.node.destroyPlayer(player.guildId);
132
- * ```
133
- */
134
- destroyPlayer(guildId: any): Promise<void>;
135
- /**
136
- * Connect to the Lavalink Node
137
- * @param sessionId Provide the Session Id of the previous connection, to resume the node and it's player(s)
138
- * @returns void
139
- *
140
- * @example
141
- * ```ts
142
- * player.node.connect(); // if provided on bootup in managerOptions#nodes, this will be called automatically when doing lavalink.init()
143
- *
144
- * // or connect from a resuming session:
145
- * player.node.connect("sessionId");
146
- * ```
147
- */
148
- connect(sessionId?: string): void;
149
- private heartBeat;
150
- /**
151
- * Get the id of the node
152
- *
153
- * @example
154
- * ```ts
155
- * const nodeId = player.node.id;
156
- * console.log("node id is: ", nodeId)
157
- * ```
158
- */
159
- get id(): string;
160
- /**
161
- * Destroys the Node-Connection (Websocket) and all player's of the node
162
- * @param destroyReason Destroy Reason to use when destroying the players
163
- * @param deleteNode wether to delete the nodte from the nodes list too, if false it will emit a disconnect. @default true
164
- * @param movePlayers whether to movePlayers to different eligible connected node. If false players won't be moved @default false
165
- * @returns void
166
- *
167
- * @example
168
- * Destroys node and its players
169
- * ```ts
170
- * player.node.destroy("custom Player Destroy Reason", true);
171
- * ```
172
- * destroys only the node and moves its players to different connected node.
173
- * ```ts
174
- * player.node.destroy("custom Player Destroy Reason", true, true);
175
- * ```
176
- */
177
- destroy(destroyReason?: DestroyReasonsType, deleteNode?: boolean, movePlayers?: boolean): void;
178
- /**
179
- * Disconnects the Node-Connection (Websocket)
180
- * @param disconnectReason Disconnect Reason to use when disconnecting Node
181
- * @returns void
182
- *
183
- * Also the node will not get re-connected again.
184
- *
185
- * @example
186
- * ```ts
187
- * player.node.destroy("custom Player Destroy Reason", true);
188
- * ```
189
- */
190
- disconnect(disconnectReason?: DisconnectReasonsType): void;
191
- /**
192
- * Returns if connected to the Node.
193
- *
194
- * @example
195
- * ```ts
196
- * const isConnected = player.node.connected;
197
- * console.log("node is connected: ", isConnected ? "yes" : "no")
198
- * ```
199
- */
200
- get connected(): boolean;
201
- /**
202
- * Returns the current ConnectionStatus
203
- *
204
- * @example
205
- * ```ts
206
- * try {
207
- * const statusOfConnection = player.node.connectionStatus;
208
- * console.log("node's connection status is:", statusOfConnection)
209
- * } catch (error) {
210
- * console.error("no socket available?", error)
211
- * }
212
- * ```
213
- */
214
- get connectionStatus(): string;
215
- /**
216
- * Gets all Players of a Node
217
- * @returns array of players inside of lavalink
218
- *
219
- * @example
220
- * ```ts
221
- * const node = lavalink.nodes.get("NODEID");
222
- * const playersOfLavalink = await node?.fetchAllPlayers();
223
- * ```
224
- */
225
- fetchAllPlayers(): Promise<LavalinkPlayer[] | InvalidLavalinkRestRequest | null>;
226
- /**
227
- * Gets specific Player Information
228
- * @returns lavalink player object if player exists on lavalink
229
- *
230
- * @example
231
- * ```ts
232
- * const node = lavalink.nodes.get("NODEID");
233
- * const playerInformation = await node?.fetchPlayer("guildId");
234
- * ```
235
- */
236
- fetchPlayer(guildId: string): Promise<LavalinkPlayer | InvalidLavalinkRestRequest | null>;
237
- /**
238
- * Updates the session with and enables/disables resuming and timeout
239
- * @param resuming Whether resuming is enabled for this session or not
240
- * @param timeout The timeout in seconds (default is 60s)
241
- * @returns the result of the request
242
- *
243
- * @example
244
- * ```ts
245
- * const node = player.node || lavalink.nodes.get("NODEID");
246
- * await node?.updateSession(true, 180e3); // will enable resuming for 180seconds
247
- * ```
248
- */
249
- updateSession(resuming?: boolean, timeout?: number): Promise<Session | InvalidLavalinkRestRequest | null>;
250
- /**
251
- * Decode Track or Tracks
252
- */
253
- decode: {
254
- /**
255
- * Decode a single track into its info
256
- * @param encoded valid encoded base64 string from a track
257
- * @param requester the requesteruser for building the track
258
- * @returns decoded track from lavalink
259
- *
260
- * @example
261
- * ```ts
262
- * const encodedBase64 = 'QAACDgMACk5vIERpZ2dpdHkAC0JsYWNrc3RyZWV0AAAAAAAEo4AABjkxNjQ5NgABAB9odHRwczovL2RlZXplci5jb20vdHJhY2svOTE2NDk2AQBpaHR0cHM6Ly9lLWNkbnMtaW1hZ2VzLmR6Y2RuLm5ldC9pbWFnZXMvY292ZXIvZGFlN2EyNjViNzlmYjcxMjc4Y2RlMjUwNDg0OWQ2ZjcvMTAwMHgxMDAwLTAwMDAwMC04MC0wLTAuanBnAQAMVVNJUjE5NjAwOTc4AAZkZWV6ZXIBAChObyBEaWdnaXR5OiBUaGUgVmVyeSBCZXN0IE9mIEJsYWNrc3RyZWV0AQAjaHR0cHM6Ly93d3cuZGVlemVyLmNvbS9hbGJ1bS8xMDMyNTQBACJodHRwczovL3d3dy5kZWV6ZXIuY29tL2FydGlzdC8xODYxAQBqaHR0cHM6Ly9lLWNkbnMtaW1hZ2VzLmR6Y2RuLm5ldC9pbWFnZXMvYXJ0aXN0L2YxNmNhYzM2ZmVjMzkxZjczN2I3ZDQ4MmY1YWM3M2UzLzEwMDB4MTAwMC0wMDAwMDAtODAtMC0wLmpwZwEAT2h0dHBzOi8vY2RuLXByZXZpZXctYS5kemNkbi5uZXQvc3RyZWFtL2MtYTE1Yjg1NzFhYTYyMDBjMDQ0YmY1OWM3NmVkOTEyN2MtNi5tcDMAAAAAAAAAAAA=';
263
- * const track = await player.node.decode.singleTrack(encodedBase64, interaction.user);
264
- * ```
265
- */
266
- singleTrack: (encoded: Base64, requester: unknown) => Promise<Track>;
267
- /**
268
- * Decodes multiple tracks into their info
269
- * @param encodeds valid encoded base64 string array from all tracks
270
- * @param requester the requesteruser for building the tracks
271
- * @returns array of all tracks you decoded
272
- *
273
- * @example
274
- * ```ts
275
- * const encodedBase64_1 = 'QAACDgMACk5vIERpZ2dpdHkAC0JsYWNrc3RyZWV0AAAAAAAEo4AABjkxNjQ5NgABAB9odHRwczovL2RlZXplci5jb20vdHJhY2svOTE2NDk2AQBpaHR0cHM6Ly9lLWNkbnMtaW1hZ2VzLmR6Y2RuLm5ldC9pbWFnZXMvY292ZXIvZGFlN2EyNjViNzlmYjcxMjc4Y2RlMjUwNDg0OWQ2ZjcvMTAwMHgxMDAwLTAwMDAwMC04MC0wLTAuanBnAQAMVVNJUjE5NjAwOTc4AAZkZWV6ZXIBAChObyBEaWdnaXR5OiBUaGUgVmVyeSBCZXN0IE9mIEJsYWNrc3RyZWV0AQAjaHR0cHM6Ly93d3cuZGVlemVyLmNvbS9hbGJ1bS8xMDMyNTQBACJodHRwczovL3d3dy5kZWV6ZXIuY29tL2FydGlzdC8xODYxAQBqaHR0cHM6Ly9lLWNkbnMtaW1hZ2VzLmR6Y2RuLm5ldC9pbWFnZXMvYXJ0aXN0L2YxNmNhYzM2ZmVjMzkxZjczN2I3ZDQ4MmY1YWM3M2UzLzEwMDB4MTAwMC0wMDAwMDAtODAtMC0wLmpwZwEAT2h0dHBzOi8vY2RuLXByZXZpZXctYS5kemNkbi5uZXQvc3RyZWFtL2MtYTE1Yjg1NzFhYTYyMDBjMDQ0YmY1OWM3NmVkOTEyN2MtNi5tcDMAAAAAAAAAAAA=';
276
- * const encodedBase64_2 = 'QAABJAMAClRhbGsgYSBMb3QACjQwNHZpbmNlbnQAAAAAAAHr1gBxTzpodHRwczovL2FwaS12Mi5zb3VuZGNsb3VkLmNvbS9tZWRpYS9zb3VuZGNsb3VkOnRyYWNrczo4NTE0MjEwNzYvMzUyYTRiOTAtNzYxOS00M2E5LWJiOGItMjIxMzE0YzFjNjNhL3N0cmVhbS9obHMAAQAsaHR0cHM6Ly9zb3VuZGNsb3VkLmNvbS80MDR2aW5jZW50L3RhbGstYS1sb3QBADpodHRwczovL2kxLnNuZGNkbi5jb20vYXJ0d29ya3MtRTN1ek5Gc0Y4QzBXLTAtb3JpZ2luYWwuanBnAQAMUVpITkExOTg1Nzg0AApzb3VuZGNsb3VkAAAAAAAAAAA=';
277
- * const tracks = await player.node.decode.multipleTracks([encodedBase64_1, encodedBase64_2], interaction.user);
278
- * ```
279
- */
280
- multipleTracks: (encodeds: Base64[], requester: unknown) => Promise<Track[]>;
281
- };
282
- lyrics: {
283
- /**
284
- * Get the lyrics of a track
285
- * @param track the track to get the lyrics for
286
- * @param skipTrackSource wether to skip the track source or not
287
- * @returns the lyrics of the track
288
- * @example
289
- *
290
- * ```ts
291
- * const lyrics = await player.node.lyrics.get(track, true);
292
- * // use it of player instead:
293
- * // const lyrics = await player.getLyrics(track, true);
294
- * ```
295
- */
296
- get: (track: Track, skipTrackSource?: boolean) => Promise<LyricsResult | null>;
297
- /**
298
- * Get the lyrics of the current playing track
299
- *
300
- * @param guildId the guild id of the player
301
- * @param skipTrackSource wether to skip the track source or not
302
- * @returns the lyrics of the current playing track
303
- * @example
304
- * ```ts
305
- * const lyrics = await player.node.lyrics.getCurrent(guildId);
306
- * // use it of player instead:
307
- * // const lyrics = await player.getCurrentLyrics();
308
- * ```
309
- */
310
- getCurrent: (guildId: string, skipTrackSource?: boolean) => Promise<LyricsResult | null>;
311
- /**
312
- * subscribe to lyrics updates for a guild
313
- * @param guildId the guild id of the player
314
- * @returns request data of the request
315
- *
316
- * @example
317
- * ```ts
318
- * await player.node.lyrics.subscribe(guildId);
319
- * // use it of player instead:
320
- * // const lyrics = await player.subscribeLyrics();
321
- * ```
322
- */
323
- subscribe: (guildId: string) => Promise<unknown>;
324
- /**
325
- * unsubscribe from lyrics updates for a guild
326
- * @param guildId the guild id of the player
327
- * @returns request data of the request
328
- *
329
- * @example
330
- * ```ts
331
- * await player.node.lyrics.unsubscribe(guildId);
332
- * // use it of player instead:
333
- * // const lyrics = await player.unsubscribeLyrics();
334
- * ```
335
- */
336
- unsubscribe: (guildId: string) => Promise<void>;
337
- };
338
- /**
339
- * Request Lavalink statistics.
340
- * @returns the lavalink node stats
341
- *
342
- * @example
343
- * ```ts
344
- * const lavalinkStats = await player.node.fetchStats();
345
- * ```
346
- */
347
- fetchStats(): Promise<BaseNodeStats>;
348
- /**
349
- * Request Lavalink version.
350
- * @returns the current used lavalink version
351
- *
352
- * @example
353
- * ```ts
354
- * const lavalinkVersion = await player.node.fetchVersion();
355
- * ```
356
- */
357
- fetchVersion(): Promise<string>;
358
- /**
359
- * Request Lavalink information.
360
- * @returns lavalink info object
361
- *
362
- * @example
363
- * ```ts
364
- * const lavalinkInfo = await player.node.fetchInfo();
365
- * const availablePlugins:string[] = lavalinkInfo.plugins.map(plugin => plugin.name);
366
- * const availableSources:string[] = lavalinkInfo.sourceManagers;
367
- * ```
368
- */
369
- fetchInfo(): Promise<LavalinkInfo>;
370
- /**
371
- * Lavalink's Route Planner Api
372
- */
373
- routePlannerApi: {
374
- /**
375
- * Get routplanner Info from Lavalink for ip rotation
376
- * @returns the status of the routeplanner
377
- *
378
- * @example
379
- * ```ts
380
- * const routePlannerStatus = await player.node.routePlannerApi.getStatus();
381
- * const usedBlock = routePlannerStatus.details?.ipBlock;
382
- * const currentIp = routePlannerStatus.currentAddress;
383
- * ```
384
- */
385
- getStatus: () => Promise<RoutePlanner>;
386
- /**
387
- * Release blacklisted IP address into pool of IPs for ip rotation
388
- * @param address IP address
389
- * @returns request data of the request
390
- *
391
- * @example
392
- * ```ts
393
- * await player.node.routePlannerApi.unmarkFailedAddress("ipv6address");
394
- * ```
395
- */
396
- unmarkFailedAddress: (address: string) => Promise<unknown>;
397
- /**
398
- * Release all blacklisted IP addresses into pool of IPs
399
- * @returns request data of the request
400
- *
401
- * @example
402
- * ```ts
403
- * await player.node.routePlannerApi.unmarkAllFailedAddresses();
404
- * ```
405
- */
406
- unmarkAllFailedAddresses: () => Promise<unknown>;
407
- };
408
- /** @private Utils for validating the */
409
- private validate;
410
- /**
411
- * Sync the data of the player you make an action to lavalink to
412
- * @param data data to use to update the player
413
- * @param res result data from lavalink, to override, if available
414
- * @returns boolean
415
- */
416
- private syncPlayerData;
417
- /**
418
- * Get the rest Adress for making requests
419
- */
420
- private get restAddress();
421
- /**
422
- * Reconnect to the lavalink node
423
- * @param instaReconnect @default false wether to instantly try to reconnect
424
- * @returns void
425
- *
426
- * @example
427
- * ```ts
428
- * await player.node.reconnect();
429
- * ```
430
- */
431
- private reconnect;
432
- /** @private util function for handling opening events from websocket */
433
- private open;
434
- /** @private util function for handling closing events from websocket */
435
- private close;
436
- /** @private util function for handling error events from websocket */
437
- private error;
438
- /** @private util function for handling message events from websocket */
439
- private message;
440
- /** @private middleware util function for handling all kind of events from websocket */
441
- private handleEvent;
442
- private getTrackOfPayload;
443
- /** @private util function for handling trackStart event */
444
- private trackStart;
445
- /** @private util function for handling trackEnd event */
446
- private trackEnd;
447
- /** @private util function for handling trackStuck event */
448
- private trackStuck;
449
- /** @private util function for handling trackError event */
450
- private trackError;
451
- /** @private util function for handling socketClosed event */
452
- private socketClosed;
453
- /** @private util function for handling SponsorBlock Segmentloaded event */
454
- private SponsorBlockSegmentLoaded;
455
- /** @private util function for handling SponsorBlock SegmentSkipped event */
456
- private SponsorBlockSegmentSkipped;
457
- /** @private util function for handling SponsorBlock Chaptersloaded event */
458
- private SponsorBlockChaptersLoaded;
459
- /** @private util function for handling SponsorBlock Chaptersstarted event */
460
- private SponsorBlockChapterStarted;
461
- /**
462
- * Get the current sponsorblocks for the sponsorblock plugin
463
- * @param player passthrough the player
464
- * @returns sponsorblock seggment from lavalink
465
- *
466
- * @example
467
- * ```ts
468
- * // use it on the player via player.getSponsorBlock();
469
- * const sponsorBlockSegments = await player.node.getSponsorBlock(player);
470
- * ```
471
- */
472
- getSponsorBlock(player: Player): Promise<SponsorBlockSegment[]>;
473
- /**
474
- * Set the current sponsorblocks for the sponsorblock plugin
475
- * @param player passthrough the player
476
- * @returns void
477
- *
478
- * @example
479
- * ```ts
480
- * // use it on the player via player.setSponsorBlock();
481
- * const sponsorBlockSegments = await player.node.setSponsorBlock(player, ["sponsor", "selfpromo"]);
482
- * ```
483
- */
484
- setSponsorBlock(player: Player, segments?: SponsorBlockSegment[]): Promise<void>;
485
- /**
486
- * Delete the sponsorblock plugins
487
- * @param player passthrough the player
488
- * @returns void
489
- *
490
- * @example
491
- * ```ts
492
- * // use it on the player via player.deleteSponsorBlock();
493
- * const sponsorBlockSegments = await player.node.deleteSponsorBlock(player);
494
- * ```
495
- */
496
- deleteSponsorBlock(player: Player): Promise<void>;
497
- /** private util function for handling the queue end event */
498
- private queueEnd;
499
- /**
500
- * Emitted whenever a line of lyrics gets emitted
501
- * @event
502
- * @param {Player} player The player that emitted the event
503
- * @param {Track} track The track that emitted the event
504
- * @param {LyricsLineEvent} payload The payload of the event
505
- */
506
- private LyricsLine;
507
- /**
508
- * Emitted whenever the lyrics for a track got found
509
- * @event
510
- * @param {Player} player The player that emitted the event
511
- * @param {Track} track The track that emitted the event
512
- * @param {LyricsFoundEvent} payload The payload of the event
513
- */
514
- private LyricsFound;
515
- /**
516
- * Emitted whenever the lyrics for a track got not found
517
- * @event
518
- * @param {Player} player The player that emitted the event
519
- * @param {Track} track The track that emitted the event
520
- * @param {LyricsNotFoundEvent} payload The payload of the event
521
- */
522
- private LyricsNotFound;
523
- }