discord-player
Advanced tools
Comparing version 1.3.4 to 1.3.5
{ | ||
"name": "discord-player", | ||
"version": "1.3.4", | ||
"version": "1.3.5", | ||
"description": "Complete framework to facilitate music commands using discord.js v12", | ||
@@ -25,3 +25,3 @@ "main": "index.js", | ||
"author": "Androz2091", | ||
"license": "ISC", | ||
"license": "MIT", | ||
"bugs": { | ||
@@ -38,2 +38,3 @@ "url": "https://github.com/Androz2091/discord-player/issues" | ||
"devDependencies": { | ||
"discord.js": "discordjs/discord.js", | ||
"jsdoc": "^3.6.3", | ||
@@ -40,0 +41,0 @@ "minami": "^1.2.3" |
@@ -5,2 +5,4 @@ const ytdl = require('ytdl-core'); | ||
const { VoiceChannel, version } = require("discord.js"); | ||
if(version.split('.')[0] !== '12') throw new Error("Only the master branch of discord.js library is supported for now. Install it using 'npm install discordjs/discord.js'."); | ||
const Queue = require('./Queue'); | ||
@@ -96,5 +98,7 @@ const Util = require('./Util'); | ||
return new Promise(async (resolve, reject) => { | ||
if(typeof voiceChannel !== VoiceChannel) return reject("voiceChannel must be type of VoiceChannel. value="+voiceChannel); | ||
if(typeof songName !== "string") return reject("songName must be type of string. value="+songName); | ||
// Searches the song | ||
let video = await Util.getFirstYoutubeResult(songName, this.SYA); | ||
if(!video) reject('Song not found'); | ||
if(!video) return reject('Song not found'); | ||
// Joins the voice channel | ||
@@ -125,3 +129,3 @@ let connection = await voiceChannel.join(); | ||
let queue = this.queues.find((g) => g.guildID === guildID); | ||
if(!queue) reject('Not playing'); | ||
if(!queue) return reject('Not playing'); | ||
// Pauses the dispatcher | ||
@@ -144,3 +148,3 @@ queue.dispatcher.pause(); | ||
let queue = this.queues.find((g) => g.guildID === guildID); | ||
if(!queue) reject('Not playing'); | ||
if(!queue) return reject('Not playing'); | ||
// Pauses the dispatcher | ||
@@ -163,3 +167,3 @@ queue.dispatcher.resume(); | ||
let queue = this.queues.find((g) => g.guildID === guildID); | ||
if(!queue) reject('Not playing'); | ||
if(!queue) return reject('Not playing'); | ||
// Stops the dispatcher | ||
@@ -184,3 +188,3 @@ queue.stopped = true; | ||
let queue = this.queues.find((g) => g.guildID === guildID); | ||
if(!queue) reject('Not playing'); | ||
if(!queue) return reject('Not playing'); | ||
// Updates volume | ||
@@ -214,6 +218,6 @@ queue.dispatcher.setVolumeLogarithmic(percent / 200); | ||
let queue = this.queues.find((g) => g.guildID === guildID); | ||
if(!queue) reject('Not playing'); | ||
if(!queue) return reject('Not playing'); | ||
// Searches the song | ||
let video = await Util.getFirstYoutubeResult(songName, this.SYA).catch(() => {}); | ||
if(!video) reject('Song not found'); | ||
if(!video) return reject('Song not found'); | ||
let song = new Song(video, queue); | ||
@@ -237,3 +241,3 @@ // Updates queue | ||
let queue = this.queues.find((g) => g.guildID === guildID); | ||
if(!queue) reject('Not playing'); | ||
if(!queue) return reject('Not playing'); | ||
// Updates queue | ||
@@ -255,3 +259,3 @@ queue.songs = songs; | ||
let queue = this.queues.find((g) => g.guildID === guildID); | ||
if(!queue) reject('Not playing'); | ||
if(!queue) return reject('Not playing'); | ||
// Clears queue | ||
@@ -274,3 +278,3 @@ let currentlyPlaying = queue.songs.shift(); | ||
let queue = this.queues.find((g) => g.guildID === guildID); | ||
if(!queue) reject('Not playing'); | ||
if(!queue) return reject('Not playing'); | ||
let currentSong = queue.songs[0]; | ||
@@ -294,3 +298,3 @@ // Ends the dispatcher | ||
let queue = this.queues.find((g) => g.guildID === guildID); | ||
if(!queue) reject('Not playing'); | ||
if(!queue) return reject('Not playing'); | ||
let currentSong = queue.songs[0]; | ||
@@ -312,3 +316,3 @@ // Resolves the current song | ||
let queue = this.queues.find((g) => g.guildID === guildID); | ||
if(!queue) reject('Not playing'); | ||
if(!queue) return reject('Not playing'); | ||
// Enable/Disable repeat mode | ||
@@ -315,0 +319,0 @@ queue.repeatMode = enabled; |
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
33686
11
573
3