ksoft.js
Advanced tools
Comparing version 1.1.8 to 1.1.9
@@ -137,5 +137,6 @@ /** | ||
* @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) { | ||
async searchAndPlay(query, voiceChannelConnection, libraryVersion) { | ||
if (!query) throw new Error('[Ksoft API] Please provide a search query'); | ||
@@ -146,4 +147,14 @@ const youtubeResult = await require('../util/searchYoutube')(query); | ||
}); | ||
if (voiceChannelConnection) { | ||
voiceChannelConnection.play(require('ytdl-core')(youtubeResult[0].url, { filter: 'audioonly' })); | ||
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' })); | ||
} | ||
} | ||
@@ -150,0 +161,0 @@ |
{ | ||
"name": "ksoft.js", | ||
"version": "1.1.8", | ||
"version": "1.1.9", | ||
"description": "Official API Wrapper for KSoft.Si API, written in Node.js", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -104,3 +104,3 @@ # ksoft.js | ||
ksoft.bans.guildMembersCheck(guildMemberCollection, { | ||
// The guildMemberCollection is the discord.js guildMemberCollection that I can go through and check to see if they are banned | ||
// The guildMemberCollection is the discord.js/eris guildMemberCollection that I can go through and check to see if they are banned | ||
moreInfo: Boolean, | ||
@@ -155,3 +155,3 @@ ignoreBots: Boolean, | ||
voiceConnection is the discord.js voiceConnection object you get when you connect to a voice channel. This command will search both youtube and the api for a song and if you provide a voice channel connection it will start playing the song and in the promise return the lyrics. This isn't 100% accurate so use at your own risk. | ||
voiceConnection is the discord.js/eris voiceConnection object you get when you connect to a voice channel. This command will search both youtube and the api for a song and if you provide a voice channel connection it will start playing the song and in the promise return the lyrics. This isn't 100% accurate so use at your own risk. | ||
@@ -158,0 +158,0 @@ ```javascript |
87480
1079