aqualink 1.7.0-beta2 → 1.7.0-beta4

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 CHANGED
@@ -19,6 +19,10 @@ This code is based in riffy, but its an 100% Rewrite made from scratch...
19
19
  - Easy player, node, aqua managing
20
20
  - Fast responses from rest and node
21
21
  - Playlist support (My mix playlists, youtube playlists, spotify playlists)
22
+ - Lyrics Support by Lavalink
23
+ - https://github.com/topi314/LavaLyrics (RECOMMENDED)
24
+ - https://github.com/DRSchlaubi/lyrics.kt (?)
25
+ - https://github.com/DuncteBot/java-timed-lyrics (RECOMMENDED)
22
26
 
23
27
  # Docs (Wiki)
24
28
  - https://github.com/ToddyTheNoobDud/AquaLink/wiki
@@ -178,4 +182,4 @@ client.aqua.on("nodeError", (node, error) => {
178
182
  });
179
183
 
180
184
  client.login("Yourtokenhere");
181
- ```
185
+ ```
@@ -300,4 +300,4 @@ class Node {
300
300
  }
301
301
  }
302
302
 
303
- module.exports = { Node };
303
+ module.exports = { Node };
@@ -49,6 +49,10 @@ class Player extends EventEmitter {
49
49
  return this.previousTracks.length ? this.previousTracks[0] : null;
50
50
  }
51
51
 
52
+ get currenttrack() {
53
+ return this.current;
54
+ }
55
+
52
56
  addToPreviousTrack(track) {
53
57
  if (this.previousTracks.length >= 50) {
54
58
  this.previousTracks.pop();
@@ -101,11 +105,38 @@ class Player extends EventEmitter {
101
105
  return this;
102
106
  }
103
107
 
108
+ async searchLyrics(query) {
109
+ if (!query) return null;
110
+
111
+ const response = await this.nodes.rest.getLyrics({
112
+ track: {
113
+ encoded: { info: { title: query } },
114
+ guild_id: this.guildId,
115
+ search: true
116
+ }
117
+ });
118
+
119
+ return response || null;
120
+ }
121
+ async lyrics() {
122
+ if (!this.playing) return null;
123
+ const response = await this.nodes.rest.getLyrics({
124
+ track: {
125
+ encoded: this.current.track,
126
+ guild_id: this.guildId
127
+ },
128
+ });
129
+ return response || null;
130
+ }
131
+
104
132
  seek(position) {
105
- if (position < 0) throw new Error("Seek position cannot be negative.");
106
- if (!this.playing) return this;
107
- this.position = position;
108
- this.updatePlayer({ position });
133
+ if (!this.playing) return this;
134
+ const newPosition = this.position + position;
135
+ if (newPosition < 0) {
136
+ throw new Error("Seek position cannot be negative.");
137
+ }
138
+ this.position = newPosition;
139
+ this.updatePlayer({ position: this.position });
109
140
  return this;
110
141
  }
111
142
 
@@ -220,7 +251,6 @@ class Player extends EventEmitter {
220
251
  try {
221
252
  await this.nowPlayingMessage.delete();
222
253
  } catch (error) {
223
- // Consider logging specific errors
224
254
  } finally {
225
255
  this.nowPlayingMessage = null;
226
256
  }
@@ -96,6 +96,16 @@ class Rest {
96
96
  getRoutePlannerAddress(address) {
97
97
  return this.makeRequest("POST", `/${this.version}/routeplanner/free/address`, { address });
98
98
  }
99
+ async getLyrics({ track }) {
100
+ if (track.search) {
101
+ const v2 = await this.makeRequest("GET", `/v4/lyrics/search?query=${track.encoded.info.title}&source=genius`);
102
+ if (v2) {
103
+ return v2;
104
+ }
105
+ }
106
+ const v4 = await this.makeRequest("GET", `/v4/sessions/${this.sessionId}/players/${track.guild_id}/track/lyrics?skipTrackSource=false`);
107
+ return v4;
108
+ }
99
109
  }
100
110
 
101
- module.exports = { Rest };
111
+ module.exports = { Rest };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aqualink",
3
- "version": "1.7.0-beta2",
3
+ "version": "1.7.0-beta4",
4
4
  "description": "An Lavalink wrapper, focused in speed, performance, and features, Based in Riffy!",
5
5
  "main": "build/index.js",
6
6
  "scripts": {