ksoft.js
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -137,6 +137,12 @@ /** | ||
* @param {Boolean} returnAvancedResponse Whether or not you want the full response in the promise. This is useful for checking the responses to make sure it is returning the right lyrics | ||
* @param {String} libraryVersion The library you are using and version. for d.js master just put "d.js master" for stable put "d.js stable" if you are using eris just put eris | ||
* @returns {Promise<advancedResponse>} | ||
*/ | ||
async searchAndPlay(query, voiceChannelConnection, libraryVersion) { | ||
async searchAndPlay(query, voiceChannelConnection) { | ||
let ytdl = null; | ||
try { | ||
ytdl = require('ytdl-core'); | ||
} catch (e) { | ||
throw new Error('ytdl-core is required for playing music'); | ||
} | ||
if (!query) throw new Error('[Ksoft API] Please provide a search query'); | ||
@@ -147,14 +153,6 @@ const youtubeResult = await require('../util/searchYoutube')(query); | ||
}); | ||
if (libraryVersion === 'd.js master') { | ||
if (voiceChannelConnection) { | ||
voiceChannelConnection.play(require('ytdl-core')(youtubeResult[0].url, { filter: 'audioonly' })); | ||
} | ||
} else if (libraryVersion === 'd.js stable') { | ||
if (voiceChannelConnection) { | ||
voiceChannelConnection.playStream(require('ytdl-core')(youtubeResult[0].url, { filter: 'audioonly' })); | ||
} | ||
} else { | ||
if (voiceChannelConnection) { | ||
voiceChannelConnection.play(require('ytdl-core')(youtubeResult[0].url, { filter: 'audioonly' })); | ||
} | ||
if (voiceChannelConnection) { | ||
(voiceChannelConnection.playStream || voiceChannelConnection.play)( | ||
ytdl(youtubeResult[0].url, { filter: 'audioonly' }) | ||
); | ||
} | ||
@@ -161,0 +159,0 @@ |
{ | ||
"name": "ksoft.js", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Official API Wrapper for KSoft.Si API, written in Node.js", | ||
@@ -32,4 +32,3 @@ "main": "index.js", | ||
"form-data": "^2.3.3", | ||
"public-ip": "^2.4.0", | ||
"ytdl-core": "^0.28.0" | ||
"public-ip": "^2.4.0" | ||
}, | ||
@@ -36,0 +35,0 @@ "devDependencies": { |
@@ -156,4 +156,6 @@ # ksoft.js | ||
Please note: To play music with this feature you are going to need to have ffmpeg, node-opus/opuscript, and ytdl-core installed | ||
```javascript | ||
ksoft.lyrics.searchAndPlay(query: String, voiceConnection, libraryVersion: String); // libraryVersion is the library you are using and version. for d.js master just put "d.js master" for stable put "d.js stable" if you are using eris just put eris | ||
ksoft.lyrics.searchAndPlay(query: String, voiceConnection); | ||
``` | ||
@@ -160,0 +162,0 @@ |
5
208
87168
1076
- Removedytdl-core@^0.28.0
- Removedhtml-entities@1.4.0(transitive)
- Removedm3u8stream@0.6.5(transitive)
- Removedminiget@1.7.2(transitive)
- Removedsax@1.4.1(transitive)
- Removedytdl-core@0.28.3(transitive)