Socket
Socket
Sign inDemoInstall

shoukaku

Package Overview
Dependencies
7
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.0 to 2.1.1

4

package.json
{
"name": "shoukaku",
"version": "2.1.0",
"version": "2.1.1",
"description": "A lavalink wrapper that supports almost all libraries",
"main": "index.js",
"types": "index.d.ts",
"types": "types/index.d.ts",
"scripts": {

@@ -8,0 +8,0 @@ "docs:build": "docma build",

@@ -44,3 +44,3 @@ ## Shoukaku

Download the latest binaries from the [CI server (DEV BRANCH)](https://ci.fredboat.com/viewType.html?buildTypeId=Lavalink_Build&branch_Lavalink=refs%2Fheads%2Fdev&tab=buildTypeStatusDiv)
Download the latest binaries from the [Lavalink's README](https://github.com/freyacodes/Lavalink#server-configuration)

@@ -47,0 +47,0 @@ Put an [application.yml](https://github.com/freyacodes/Lavalink/blob/master/LavalinkServer/application.yml.example) file in your working directory.

@@ -63,10 +63,2 @@ const EventEmitter = require('events');

/**
* Emitted when this library encounters an internal error
* @event ShoukakuPlayer#error
* @param {Error} error The error encountered.
* @memberOf ShoukakuPlayer
* @example
* Player.on('error', error => console.error(error) && Player.disconnect());
*/
/**
* Emitted when the lavalink player emits a TrackStartEvent

@@ -430,11 +422,13 @@ * @event ShoukakuPlayer#start

* @param {Object} json
* @param {ShoukakuSocket} socket
* @protected
*/
_onLavalinkMessage(json) {
_onLavalinkMessage(json, socket) {
if (json.op === 'playerUpdate') {
this.position = json.state.position;
this.emit('update', json);
socket.emit('playerUpdate', this, json);
}
else if (json.op === 'event') {
this._onPlayerEvent(json);
this._onPlayerEvent(json, socket);
}

@@ -450,3 +444,3 @@ else {

*/
_onPlayerEvent(json) {
_onPlayerEvent(json, socket) {
switch (json.type) {

@@ -456,2 +450,3 @@ case 'TrackStartEvent':

this.emit('start', json);
socket.emit('playerTrackStart', this, json);
break;

@@ -461,12 +456,16 @@ case 'TrackEndEvent':

this.emit('end', json);
socket.emit('playerTrackEnd', this, json);
break;
case 'TrackExceptionEvent':
this.emit('exception', json);
socket.emit('playerException', this, json);
break;
case 'WebSocketClosedEvent':
if (this.connection.reconnecting) break;
if (this.connection.moved)
if (this.connection.moved) {
this.connection.moved = !this.connection.moved;
else
} else {
this.emit('closed', json);
socket.emit('playerClosed', this, json);
}
break;

@@ -473,0 +472,0 @@ default:

@@ -292,4 +292,6 @@ const EventEmitter = require('events');

}
this.players.get(json.guildId)?._onLavalinkMessage(json);
this.players.get(json.guildId)?._onLavalinkMessage(json, this);
}
/**

@@ -296,0 +298,0 @@ * @memberOf ShoukakuSocket

@@ -144,2 +144,7 @@ const EventEmitter = require('events');

node.on('playerDestroy', (...args) => this.emit('playerDestroy', ...args));
node.on('playerTrackStart', (...args) => this.emit('playerTrackStart', ...args));
node.on('playerTrackEnd', (...args) => this.emit('playerTrackEnd', ...args));
node.on('playerException', (...args) => this.emit('playerException', ...args));
node.on('playerClosed', (...args) => this.emit('playerClosed', ...args));
node.on('playerUpdate', (...args) => this.emit('playerUpdate', ...args));
node.connect();

@@ -146,0 +151,0 @@ this.nodes.set(node.name, node);

import * as Constants from "./enums";
import { EventEmitter } from "events";
export * as Libraries from './libraries';
export * from './enums';
export { version } from '../package.json';
export type TrackEndReason = "FINISHED" | "LOAD_FAILED" | "STOPPED" | "REPLACED" | "CLEANUP";

@@ -28,23 +32,38 @@ export type Severity = "COMMON" | "SUSPICIOUS" | "FAULT";

public on(event: "debug", listener: (name: string, info: string) => void): this;
public on(event: "error", listener: (name: string, error: Error) => void): this;
public on(event: "ready", listener: (name: string, reconnect: boolean) => void): this;
public on(event: "close", listener: (name: string, code: number, reason: string) => void): this;
public on(event: "disconnect", listener: (name: string, players: ShoukakuPlayer[], moved: boolean) => void): this;
public on(event: "playerReady", listener: (name: string, player: ShoukakuPlayer) => void): this;
public on(event: "playerDestroy", listener: (name: string, player: ShoukakuPlayer) => void): this;
public once(event: "debug", listener: (name: string, info: string) => void): this;
public once(event: "error", listener: (name: string, error: Error) => void): this;
public once(event: "ready", listener: (name: string, reconnect: boolean) => void): this;
public once(event: "close", listener: (name: string, code: number, reason: string) => void): this;
public once(event: "disconnect", listener: (name: string, players: ShoukakuPlayer[], moved: boolean) => void): this;
public once(event: "playerReady", listener: (name: string, player: ShoukakuPlayer) => void): this;
public once(event: "playerDestroy", listener: (name: string, player: ShoukakuPlayer) => void): this;
public off(event: "debug", listener: (name: string, info: string) => void): this;
public off(event: "error", listener: (name: string, error: Error) => void): this;
public off(event: "ready", listener: (name: string, reconnect: boolean) => void): this;
public off(event: "close", listener: (name: string, code: number, reason: string) => void): this;
public off(event: "disconnect", listener: (name: string, players: ShoukakuPlayer[], moved: boolean) => void): this;
public off(event: "playerReady", listener: (name: string, player: ShoukakuPlayer) => void): this;
public off(event: "playerDestroy", listener: (name: string, player: ShoukakuPlayer) => void): this;
public on(event: 'debug', listener: (name: string, info: string) => void): this;
public on(event: 'error', listener: (name: string, error: Error) => void): this;
public on(event: 'ready', listener: (name: string, reconnect: boolean) => void): this;
public on(event: 'close', listener: (name: string, code: number, reason: string) => void): this;
public on(event: 'disconnect', listener: (name: string, players: ShoukakuPlayer[], moved: boolean) => void): this;
public on(event: 'playerReady', listener: (name: string, player: ShoukakuPlayer) => void): this;
public on(event: 'playerDestroy', listener: (name: string, player: ShoukakuPlayer) => void): this;
public on(event: 'playerTrackStart', listener: (player: ShoukakuPlayer, data: TrackStartEvent) => void): this;
public on(event: 'playerTrackEnd', listener: (player: ShoukakuPlayer, data: TrackEndEvent) => void): this;
public on(event: 'playerException', listener: (player: ShoukakuPlayer, reason: TrackExceptionEvent) => void): this;
public on(event: 'playerClosed', listener: (player: ShoukakuPlayer, reason: WebSocketClosedEvent) => void): this;
public on(event: 'playerUpdate', listener: (player: ShoukakuPlayer, data: PlayerUpdate) => void): this;
public once(event: 'debug', listener: (name: string, info: string) => void): this;
public once(event: 'error', listener: (name: string, error: Error) => void): this;
public once(event: 'ready', listener: (name: string, reconnect: boolean) => void): this;
public once(event: 'close', listener: (name: string, code: number, reason: string) => void): this;
public once(event: 'disconnect', listener: (name: string, players: ShoukakuPlayer[], moved: boolean) => void): this;
public once(event: 'playerReady', listener: (name: string, player: ShoukakuPlayer) => void): this;
public once(event: 'playerDestroy', listener: (player: ShoukakuPlayer) => void): this;
public once(event: 'playerTrackStart', listener: (player: ShoukakuPlayer, data: TrackStartEvent) => void): this;
public once(event: 'playerTrackEnd', listener: (player: ShoukakuPlayer, data: TrackEndEvent) => void): this;
public once(event: 'playerException', listener: (player: ShoukakuPlayer, reason: TrackExceptionEvent) => void): this;
public once(event: 'playerClosed', listener: (player: ShoukakuPlayer, reason: WebSocketClosedEvent) => void): this;
public once(event: 'playerUpdate', listener: (player: ShoukakuPlayer, data: PlayerUpdate) => void): this;
public off(event: 'debug', listener: (name: string, info: string) => void): this;
public off(event: 'error', listener: (name: string, error: Error) => void): this;
public off(event: 'ready', listener: (name: string, reconnect: boolean) => void): this;
public off(event: 'close', listener: (name: string, code: number, reason: string) => void): this;
public off(event: 'disconnect', listener: (name: string, players: ShoukakuPlayer[], moved: boolean) => void): this;
public off(event: 'playerReady', listener: (name: string, player: ShoukakuPlayer) => void): this;
public off(event: 'playerDestroy', listener: (name: string, player: ShoukakuPlayer) => void): this;
public off(event: 'playerTrackStart', listener: (player: ShoukakuPlayer, data: TrackStartEvent) => void): this;
public off(event: 'playerTrackEnd', listener: (player: ShoukakuPlayer, data: TrackEndEvent) => void): this;
public off(event: 'playerException', listener: (player: ShoukakuPlayer, reason: TrackExceptionEvent) => void): this;
public off(event: 'playerClosed', listener: (player: ShoukakuPlayer, reason: WebSocketClosedEvent) => void): this;
public off(event: 'playerUpdate', listener: (player: ShoukakuPlayer, data: PlayerUpdate) => void): this;
}

@@ -88,3 +107,3 @@

export class ShoukakuSocket extends EventEmitter {
constructor(shoukaku: Shoukaku, options: { name: string, url: string, auth: string, secure: boolean, group?: string });
constructor(shoukaku: Shoukaku, options: { name: string; url: string; auth: string; secure: boolean; group?: string });

@@ -179,3 +198,3 @@ public shoukaku: Shoukaku;

protected reset(): void;
protected _onLavalinkMessage(json: Object): void;
protected _onLavalinkMessage(json: Object, socket: ShoukakuSocket): void;
private _onPlayerEvent(json: Object): void;

@@ -186,3 +205,2 @@ private _onWebsocketClosedEvent(json: WebSocketClosedEvent): void;

public on(event: 'closed', listener: (reason: WebSocketClosedEvent) => void): this;
public on(event: 'error', listener: (error: Error) => void): this;
public on(event: 'start', listener: (data: TrackStartEvent) => void): this;

@@ -194,3 +212,2 @@ public on(event: 'exception', listener: (reason: TrackExceptionEvent) => void): this;

public once(event: 'closed', listener: (reason: WebSocketClosedEvent) => void): this;
public once(event: 'error', listener: (error: Error) => void): this;
public once(event: 'start', listener: (data: TrackStartEvent) => void): this;

@@ -202,3 +219,2 @@ public once(event: 'exception', listener: (reason: TrackExceptionEvent) => void): this;

public off(event: 'closed', listener: (reason: WebSocketClosedEvent) => void): this;
public off(event: 'error', listener: (error: Error) => void): this;
public off(event: 'start', listener: (data: TrackStartEvent) => void): this;

@@ -240,2 +256,3 @@ public off(event: 'exception', listener: (reason: TrackExceptionEvent) => void): this;

public info: {
sourceName?: string;
identifier?: string;

@@ -350,7 +367,7 @@ isSeekable?: boolean;

export interface JoinOptions {
guildId: Snowflake,
shardId: number,
channelId: Snowflake,
mute?: boolean,
deaf?: boolean
guildId: Snowflake;
shardId: number;
channelId: Snowflake;
mute?: boolean;
deaf?: boolean;
}

@@ -357,0 +374,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc