Comparing version 1.3.5 to 1.3.6
{ | ||
"name": "shoukaku", | ||
"version": "1.3.5", | ||
"version": "1.3.6", | ||
"description": "A lavalink client for Discord.js v12 only", | ||
@@ -34,4 +34,4 @@ "main": "index.js", | ||
"discord.js": "github:discordjs/discord.js", | ||
"typescript": "^3.5.2" | ||
"typescript": "^3.7.5" | ||
} | ||
} |
@@ -88,4 +88,3 @@ const { ShoukakuStatus } = require('../constants/ShoukakuConstants.js'); | ||
if (this._timeout) clearTimeout(this._timeout); | ||
if (this.state !== ShoukakuStatus.CONNECTING) | ||
return this.player._listen('error', error); | ||
if (this.state !== ShoukakuStatus.CONNECTING) return this.player._listen('error', error); | ||
this.state = ShoukakuStatus.DISCONNECTED; | ||
@@ -130,5 +129,7 @@ if (this._callback) this._callback(error); | ||
this._destroy() | ||
.catch(() => null); | ||
this._sendDiscordWS({ guild_id: this.guildID, channel_id: null, self_mute: false, self_deaf: false }); | ||
this.state = ShoukakuStatus.DISCONNECTED; | ||
.catch((error) => this.node.shoukaku.emit('error', this.node.name, error)) | ||
.finally(() => { | ||
this._sendDiscordWS({ guild_id: this.guildID, channel_id: null, self_mute: false, self_deaf: false }); | ||
this.state = ShoukakuStatus.DISCONNECTED; | ||
}); | ||
} | ||
@@ -135,0 +136,0 @@ } |
@@ -0,0 +0,0 @@ const EventEmitter = require('events'); |
@@ -56,8 +56,4 @@ const Websocket = require('ws'); | ||
this.name = node.name; | ||
/** | ||
* URL of the websocket used in this node. | ||
* @type {string} | ||
*/ | ||
this.url = `ws://${node.host}:${node.port}`; | ||
Object.defineProperty(this, 'url', { value: `ws://${node.host}:${node.port}` }); | ||
Object.defineProperty(this, 'auth', { value: node.auth }); | ||
@@ -140,4 +136,8 @@ Object.defineProperty(this, 'resumed', { value: false, writable: true }); | ||
if (this.players.has(options.guildID)) | ||
return reject(new ShoukakuError('A Player is already established in this channel')); | ||
let player = this.players.get(options.guildID); | ||
if (player) { | ||
if (player.voiceConnection.state !== ShoukakuStatus.CONNECTED) | ||
return reject(new ShoukakuError('A Player is currently connecting to this channel')); | ||
return player; | ||
} | ||
@@ -148,3 +148,3 @@ const guild = this.shoukaku.client.guilds.get(options.guildID); | ||
const player = new ShoukakuPlayer(this, guild); | ||
player = new ShoukakuPlayer(this, guild); | ||
this.players.set(guild.id, player); | ||
@@ -151,0 +151,0 @@ |
@@ -7,4 +7,10 @@ const { RawRouter, ReconnectRouter } = require('./router/ShoukakuRouter.js'); | ||
const EventEmitter = require('events'); | ||
const { version } = require('discord.js'); | ||
let version; | ||
try { | ||
version = require('discord.js').version; | ||
} catch (_) { | ||
version = null; | ||
} | ||
/** | ||
@@ -41,3 +47,3 @@ * @external Client | ||
super(); | ||
if (!version.startsWith('12')) | ||
if (version && !version.startsWith('12')) | ||
throw new ShoukakuError('Shoukaku will only work in Discord.JS v12 / Discord.JS Master Branch. Versions below Discord.JS v12 is not supported.'); | ||
@@ -44,0 +50,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
68420
1559