discord-player
Advanced tools
Comparing version 1.0.5 to 1.0.6
{ | ||
"name": "discord-player", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "Complete framework to facilitate music commands using discord.js v12", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -77,3 +77,3 @@ const ytdl = require('ytdl-core'); | ||
// Searches the song | ||
let video = await Util.getFirstYoutubeResult(songName, this.SYA).catch(() => {}); | ||
let video = await Util.getFirstYoutubeResult(songName, this.SYA); | ||
if(!video) reject('Song not found'); | ||
@@ -80,0 +80,0 @@ // Joins the voice channel |
@@ -20,13 +20,17 @@ const fetch = require('node-fetch'); | ||
// Try with URL | ||
let video = await SYA.getVideo(search).catch(() => {}); | ||
if(video){ | ||
video = await video.fetch() | ||
SYA.getVideo(search).then(async (video) => { | ||
video = await video.fetch(); | ||
resolve(video); | ||
} | ||
// Try with song name | ||
let results = await SYA.searchVideos(search, 1); | ||
if(results.length < 1) reject('Not found'); | ||
let fetched = await results.shift().fetch(); | ||
results.push(fetched) | ||
resolve(results.pop()); | ||
}).catch(async (err) => { | ||
if(err.message === "Bad Request"){ | ||
reject('Invalid Youtube Data v3 API key.'); | ||
} else { | ||
// Try with song name | ||
let results = await SYA.searchVideos(search, 1); | ||
if(results.length < 1) return reject('Not found'); | ||
let fetched = await results.shift().fetch(); | ||
results.push(fetched); | ||
resolve(results.pop()); | ||
} | ||
}); | ||
}); | ||
@@ -33,0 +37,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23995
433