muthera 1.0.6 → 1.0.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muthera",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "A simple Lavalink wrapper for Discord music bot. Forked from Niizuki.",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -121,6 +121,37 @@ class Player extends EventEmitter {
121
121
  return this.stop();
122
122
  }
123
123
 
124
+ return this;
125
+ } catch (e) {
126
+ return this.stop();
127
+ }
128
+ } else if (player.previous.info.sourceName === "youtubemusic") {
129
+ try {
130
+ let data = `https://music.youtube.com/watch?v=${player.previous.info.identifier}&list=RD${player.previous.info.identifier}`;
131
+ let response = await this.muthera.resolve({
132
+ query: data,
133
+ requester: player.previous.info.requester,
134
+ });
135
+
136
+ if (
137
+ !response ||
138
+ !response.tracks ||
139
+ ["error", "empty"].includes(response.loadType)
140
+ )
141
+ return this.stop();
142
+
143
+ let track =
144
+ response.tracks[
145
+ Math.floor(Math.random() * Math.floor(response.tracks.length))
146
+ ];
147
+
148
+ if (this.connected) {
149
+ this.queue.push(track);
150
+ await this.play();
151
+ } else {
152
+ return this.stop();
153
+ }
154
+
124
155
  return this;
125
156
  } catch (e) {
126
157
  return this.stop();