discord-player
Advanced tools
Comparing version 1.3.5 to 1.3.7
{ | ||
"name": "discord-player", | ||
"version": "1.3.5", | ||
"version": "1.3.7", | ||
"description": "Complete framework to facilitate music commands using discord.js v12", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -97,3 +97,3 @@ const ytdl = require('ytdl-core'); | ||
return new Promise(async (resolve, reject) => { | ||
if(typeof voiceChannel !== VoiceChannel) return reject("voiceChannel must be type of VoiceChannel. value="+voiceChannel); | ||
if(!voiceChannel || typeof voiceChannel !== "object") return reject("voiceChannel must be type of VoiceChannel. value="+voiceChannel); | ||
if(typeof songName !== "string") return reject("songName must be type of string. value="+songName); | ||
@@ -100,0 +100,0 @@ // Searches the song |
@@ -21,2 +21,7 @@ /** | ||
/** | ||
* Raw video object from Simple Youtube API | ||
* @type {Video} | ||
*/ | ||
this.rawVideo = video; | ||
/** | ||
* Raw informations about the song. | ||
@@ -23,0 +28,0 @@ * @type {Object} |
@@ -28,8 +28,16 @@ const fetch = require('node-fetch'); | ||
} 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()); | ||
try { | ||
// 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()); | ||
} catch(err){ | ||
if(err.message === "Bad Request"){ | ||
reject('Invalid Youtube Data v3 API key.'); | ||
} else { | ||
reject(err); | ||
} | ||
} | ||
} | ||
@@ -36,0 +44,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
31970
532