Comparing version 4.1.0 to 4.1.1
@@ -180,3 +180,3 @@ import { EventEmitter } from 'events'; | ||
* Updates SessionId, ChannelId, Deafen and Mute data of this instance | ||
* | ||
* @param options | ||
* @param options.session_id Id of the current session | ||
@@ -386,6 +386,2 @@ * @param options.channel_id Id of the connected voice channel | ||
filters: FilterOptions; | ||
/** | ||
* @param node An instance of Node (Lavalink API wrapper) | ||
* @param connection An instance of connection class | ||
*/ | ||
constructor(guildId: string, node: Node); | ||
@@ -405,4 +401,2 @@ get data(): UpdatePlayerInfo; | ||
* Play a new track | ||
* @param playable Options for playing this track | ||
* @param noReplace Set it to true if you don't want to replace the currently playing track | ||
*/ | ||
@@ -769,2 +763,18 @@ playTrack(playerOptions: PlayOptions, noReplace?: boolean): Promise<void>; | ||
} | ||
interface NodeMemory { | ||
reservable: number; | ||
used: number; | ||
free: number; | ||
allocated: number; | ||
} | ||
interface NodeFrameStats { | ||
sent: number; | ||
deficit: number; | ||
nulled: number; | ||
} | ||
interface NodeCpu { | ||
cores: number; | ||
systemLoad: number; | ||
lavalinkLoad: number; | ||
} | ||
interface Stats { | ||
@@ -774,18 +784,5 @@ op: OpCodes.STATS; | ||
playingPlayers: number; | ||
memory: { | ||
reservable: number; | ||
used: number; | ||
free: number; | ||
allocated: number; | ||
}; | ||
frameStats?: { | ||
sent: number; | ||
deficit: number; | ||
nulled: number; | ||
}; | ||
cpu: { | ||
cores: number; | ||
systemLoad: number; | ||
lavalinkLoad: number; | ||
}; | ||
memory: NodeMemory; | ||
frameStats: NodeFrameStats | null; | ||
cpu: NodeCpu; | ||
uptime: number; | ||
@@ -1244,2 +1241,2 @@ } | ||
export { type Address, AllowedPackets, type Band, type ChannelMixSettings, Connection, Connector, type ConnectorMethods, index as Connectors, Constants, type DistortionSettings, type EmptyResult, type ErrorResult, type Exception, type FilterOptions, type FreqSettings, type KaraokeSettings, type LavalinkPlayer, type LavalinkPlayerVoice, type LavalinkPlayerVoiceOptions, type LavalinkResponse, LoadType, type LowPassSettings, Node, type NodeEvents, type NodeInfo, type NodeInfoGit, type NodeInfoPlugin, type NodeInfoVersion, type NodeOption, type NonResumableHeaders, type PlayOptions, Player, type PlayerEvent, PlayerEventType, type PlayerEvents, type PlayerUpdate, type Playlist, type PlaylistResult, type Ready, Rest, RestError, type ResumableHeaders, type ResumeOptions, type RotationSettings, type RoutePlanner, type SearchResult, type ServerUpdate, type SessionInfo, type Severity, Shoukaku, type ShoukakuEvents, type ShoukakuOptions, type StateUpdatePartial, type Stats, type Structures, type TimescaleSettings, type Track, type TrackEndEvent, type TrackEndReason, type TrackExceptionEvent, type TrackResult, type TrackStartEvent, type TrackStuckEvent, type UpdatePlayerInfo, type UpdatePlayerOptions, type UpdatePlayerTrackOptions, Utils, type VoiceChannelOptions, type WebSocketClosedEvent }; | ||
export { type Address, AllowedPackets, type Band, type ChannelMixSettings, Connection, Connector, type ConnectorMethods, index as Connectors, Constants, type DistortionSettings, type EmptyResult, type ErrorResult, type Exception, type FilterOptions, type FreqSettings, type KaraokeSettings, type LavalinkPlayer, type LavalinkPlayerVoice, type LavalinkPlayerVoiceOptions, type LavalinkResponse, LoadType, type LowPassSettings, Node, type NodeCpu, type NodeEvents, type NodeFrameStats, type NodeInfo, type NodeInfoGit, type NodeInfoPlugin, type NodeInfoVersion, type NodeMemory, type NodeOption, type NonResumableHeaders, type PlayOptions, Player, type PlayerEvent, PlayerEventType, type PlayerEvents, type PlayerUpdate, type Playlist, type PlaylistResult, type Ready, Rest, RestError, type ResumableHeaders, type ResumeOptions, type RotationSettings, type RoutePlanner, type SearchResult, type ServerUpdate, type SessionInfo, type Severity, Shoukaku, type ShoukakuEvents, type ShoukakuOptions, type StateUpdatePartial, type Stats, type Structures, type TimescaleSettings, type Track, type TrackEndEvent, type TrackEndReason, type TrackExceptionEvent, type TrackResult, type TrackStartEvent, type TrackStuckEvent, type UpdatePlayerInfo, type UpdatePlayerOptions, type UpdatePlayerTrackOptions, Utils, type VoiceChannelOptions, type WebSocketClosedEvent }; |
@@ -73,3 +73,3 @@ "use strict"; | ||
name: "shoukaku", | ||
version: "4.1.0", | ||
version: "4.1.1", | ||
description: "A stable and updated wrapper around Lavalink", | ||
@@ -415,3 +415,3 @@ main: "dist/index.js", | ||
* Updates SessionId, ChannelId, Deafen and Mute data of this instance | ||
* | ||
* @param options | ||
* @param options.session_id Id of the current session | ||
@@ -494,6 +494,2 @@ * @param options.channel_id Id of the connected voice channel | ||
var Player = class extends TypedEventEmitter { | ||
/** | ||
* @param node An instance of Node (Lavalink API wrapper) | ||
* @param connection An instance of connection class | ||
*/ | ||
constructor(guildId, node) { | ||
@@ -531,6 +527,6 @@ super(); | ||
/** | ||
* Move player to another node | ||
* @param name Name of node to move to, or the default ideal node | ||
* @returns true if the player was moved, false if not | ||
*/ | ||
* Move player to another node | ||
* @param name Name of node to move to, or the default ideal node | ||
* @returns true if the player was moved, false if not | ||
*/ | ||
async move(name) { | ||
@@ -557,4 +553,4 @@ const connection = this.node.manager.connections.get(this.guildId); | ||
/** | ||
* Destroys the player in remote lavalink side | ||
*/ | ||
* Destroys the player in remote lavalink side | ||
*/ | ||
async destroy() { | ||
@@ -564,6 +560,4 @@ await this.node.rest.destroyPlayer(this.guildId); | ||
/** | ||
* Play a new track | ||
* @param playable Options for playing this track | ||
* @param noReplace Set it to true if you don't want to replace the currently playing track | ||
*/ | ||
* Play a new track | ||
*/ | ||
playTrack(playerOptions, noReplace = false) { | ||
@@ -573,4 +567,4 @@ return this.update(playerOptions, noReplace); | ||
/** | ||
* Stop the currently playing track | ||
*/ | ||
* Stop the currently playing track | ||
*/ | ||
stopTrack() { | ||
@@ -580,5 +574,5 @@ return this.update({ track: { encoded: null }, position: 0 }); | ||
/** | ||
* Pause or unpause the currently playing track | ||
* @param paused Boolean value to specify whether to pause or unpause the current bot user | ||
*/ | ||
* Pause or unpause the currently playing track | ||
* @param paused Boolean value to specify whether to pause or unpause the current bot user | ||
*/ | ||
setPaused(paused = true) { | ||
@@ -588,5 +582,5 @@ return this.update({ paused }); | ||
/** | ||
* Seek to a specific time in the currently playing track | ||
* @param position Position to seek to in milliseconds | ||
*/ | ||
* Seek to a specific time in the currently playing track | ||
* @param position Position to seek to in milliseconds | ||
*/ | ||
seekTo(position) { | ||
@@ -596,5 +590,5 @@ return this.update({ position }); | ||
/** | ||
* Sets the global volume of the player | ||
* @param volume Target volume 0-1000 | ||
*/ | ||
* Sets the global volume of the player | ||
* @param volume Target volume 0-1000 | ||
*/ | ||
setGlobalVolume(volume) { | ||
@@ -604,5 +598,5 @@ return this.update({ volume }); | ||
/** | ||
* Sets the filter volume of the player | ||
* @param volume Target volume 0.0-5.0 | ||
*/ | ||
* Sets the filter volume of the player | ||
* @param volume Target volume 0.0-5.0 | ||
*/ | ||
async setFilterVolume(volume) { | ||
@@ -612,5 +606,5 @@ return this.setFilters({ volume }); | ||
/** | ||
* Change the equalizer settings applied to the currently playing track | ||
* @param equalizer An array of objects that conforms to the Bands type that define volumes at different frequencies | ||
*/ | ||
* Change the equalizer settings applied to the currently playing track | ||
* @param equalizer An array of objects that conforms to the Bands type that define volumes at different frequencies | ||
*/ | ||
async setEqualizer(equalizer) { | ||
@@ -620,5 +614,5 @@ return this.setFilters({ equalizer }); | ||
/** | ||
* Change the karaoke settings applied to the currently playing track | ||
* @param karaoke An object that conforms to the KaraokeSettings type that defines a range of frequencies to mute | ||
*/ | ||
* Change the karaoke settings applied to the currently playing track | ||
* @param karaoke An object that conforms to the KaraokeSettings type that defines a range of frequencies to mute | ||
*/ | ||
setKaraoke(karaoke) { | ||
@@ -628,5 +622,5 @@ return this.setFilters({ karaoke: karaoke ?? null }); | ||
/** | ||
* Change the timescale settings applied to the currently playing track | ||
* @param timescale An object that conforms to the TimescaleSettings type that defines the time signature to play the audio at | ||
*/ | ||
* Change the timescale settings applied to the currently playing track | ||
* @param timescale An object that conforms to the TimescaleSettings type that defines the time signature to play the audio at | ||
*/ | ||
setTimescale(timescale) { | ||
@@ -636,5 +630,5 @@ return this.setFilters({ timescale: timescale ?? null }); | ||
/** | ||
* Change the tremolo settings applied to the currently playing track | ||
* @param tremolo An object that conforms to the FreqSettings type that defines an oscillation in volume | ||
*/ | ||
* Change the tremolo settings applied to the currently playing track | ||
* @param tremolo An object that conforms to the FreqSettings type that defines an oscillation in volume | ||
*/ | ||
setTremolo(tremolo) { | ||
@@ -644,5 +638,5 @@ return this.setFilters({ tremolo: tremolo ?? null }); | ||
/** | ||
* Change the vibrato settings applied to the currently playing track | ||
* @param vibrato An object that conforms to the FreqSettings type that defines an oscillation in pitch | ||
*/ | ||
* Change the vibrato settings applied to the currently playing track | ||
* @param vibrato An object that conforms to the FreqSettings type that defines an oscillation in pitch | ||
*/ | ||
setVibrato(vibrato) { | ||
@@ -652,5 +646,5 @@ return this.setFilters({ vibrato: vibrato ?? null }); | ||
/** | ||
* Change the rotation settings applied to the currently playing track | ||
* @param rotation An object that conforms to the RotationSettings type that defines the frequency of audio rotating round the listener | ||
*/ | ||
* Change the rotation settings applied to the currently playing track | ||
* @param rotation An object that conforms to the RotationSettings type that defines the frequency of audio rotating round the listener | ||
*/ | ||
setRotation(rotation) { | ||
@@ -660,6 +654,6 @@ return this.setFilters({ rotation: rotation ?? null }); | ||
/** | ||
* Change the distortion settings applied to the currently playing track | ||
* @param distortion An object that conforms to DistortionSettings that defines distortions in the audio | ||
* @returns The current player instance | ||
*/ | ||
* Change the distortion settings applied to the currently playing track | ||
* @param distortion An object that conforms to DistortionSettings that defines distortions in the audio | ||
* @returns The current player instance | ||
*/ | ||
setDistortion(distortion) { | ||
@@ -669,5 +663,5 @@ return this.setFilters({ distortion: distortion ?? null }); | ||
/** | ||
* Change the channel mix settings applied to the currently playing track | ||
* @param channelMix An object that conforms to ChannelMixSettings that defines how much the left and right channels affect each other (setting all factors to 0.5 causes both channels to get the same audio) | ||
*/ | ||
* Change the channel mix settings applied to the currently playing track | ||
* @param channelMix An object that conforms to ChannelMixSettings that defines how much the left and right channels affect each other (setting all factors to 0.5 causes both channels to get the same audio) | ||
*/ | ||
setChannelMix(channelMix) { | ||
@@ -677,5 +671,5 @@ return this.setFilters({ channelMix: channelMix ?? null }); | ||
/** | ||
* Change the low pass settings applied to the currently playing track | ||
* @param lowPass An object that conforms to LowPassSettings that defines the amount of suppression on higher frequencies | ||
*/ | ||
* Change the low pass settings applied to the currently playing track | ||
* @param lowPass An object that conforms to LowPassSettings that defines the amount of suppression on higher frequencies | ||
*/ | ||
setLowPass(lowPass) { | ||
@@ -685,5 +679,5 @@ return this.setFilters({ lowPass: lowPass ?? null }); | ||
/** | ||
* Change the all filter settings applied to the currently playing track | ||
* @param filters An object that conforms to FilterOptions that defines all filters to apply/modify | ||
*/ | ||
* Change the all filter settings applied to the currently playing track | ||
* @param filters An object that conforms to FilterOptions that defines all filters to apply/modify | ||
*/ | ||
setFilters(filters) { | ||
@@ -693,4 +687,4 @@ return this.update({ filters }); | ||
/** | ||
* Clear all filters applied to the currently playing track | ||
*/ | ||
* Clear all filters applied to the currently playing track | ||
*/ | ||
clearFilters() { | ||
@@ -711,6 +705,6 @@ return this.setFilters({ | ||
/** | ||
* Resumes the current track | ||
* @param options An object that conforms to ResumeOptions that specify behavior on resuming | ||
* @param noReplace Set it to true if you don't want to replace the currently playing track | ||
*/ | ||
* Resumes the current track | ||
* @param options An object that conforms to ResumeOptions that specify behavior on resuming | ||
* @param noReplace Set it to true if you don't want to replace the currently playing track | ||
*/ | ||
async resume(options = {}, noReplace = false) { | ||
@@ -730,6 +724,6 @@ const data = this.data; | ||
/** | ||
* If you want to update the whole player yourself, sends raw update player info to lavalink | ||
* @param playerOptions Options to update the player data | ||
* @param noReplace Set it to true if you don't want to replace the currently playing track | ||
*/ | ||
* If you want to update the whole player yourself, sends raw update player info to lavalink | ||
* @param playerOptions Options to update the player data | ||
* @param noReplace Set it to true if you don't want to replace the currently playing track | ||
*/ | ||
async update(playerOptions, noReplace = false) { | ||
@@ -744,4 +738,3 @@ const data = { | ||
if (playerOptions.filters) { | ||
const filters = { ...this.filters, ...playerOptions.filters }; | ||
this.filters = filters; | ||
this.filters = { ...this.filters, ...playerOptions.filters }; | ||
} | ||
@@ -758,5 +751,5 @@ if (typeof playerOptions.track !== "undefined") | ||
/** | ||
* Cleans this player instance | ||
* @internal | ||
*/ | ||
* Cleans this player instance | ||
* @internal | ||
*/ | ||
clean() { | ||
@@ -770,5 +763,5 @@ this.removeAllListeners(); | ||
/** | ||
* Sends server update to lavalink | ||
* @internal | ||
*/ | ||
* Sends server update to lavalink | ||
* @internal | ||
*/ | ||
async sendServerUpdate(connection) { | ||
@@ -788,4 +781,4 @@ const playerUpdate = { | ||
/** | ||
* Handle player update data | ||
*/ | ||
* Handle player update data | ||
*/ | ||
onPlayerUpdate(json) { | ||
@@ -798,6 +791,6 @@ const { position, ping } = json.state; | ||
/** | ||
* Handle player events received from Lavalink | ||
* @param json JSON data from Lavalink | ||
* @internal | ||
*/ | ||
* Handle player events received from Lavalink | ||
* @param json JSON data from Lavalink | ||
* @internal | ||
*/ | ||
onPlayerEvent(json) { | ||
@@ -1121,3 +1114,3 @@ switch (json.type) { | ||
}; | ||
if (this.sessionId && this.manager.options.resume) | ||
if (this.sessionId) | ||
headers["Session-Id"] = this.sessionId; | ||
@@ -1248,5 +1241,10 @@ if (!this.initialized) | ||
this.state = 5 /* DISCONNECTED */; | ||
if (!this.shouldClean) return; | ||
this.destroyed = true; | ||
this.emit("disconnect", count); | ||
if (!this.manager.options.resume) { | ||
this.sessionId = null; | ||
} | ||
if (this.shouldClean) { | ||
this.destroyed = true; | ||
this.sessionId = null; | ||
this.emit("disconnect", count); | ||
} | ||
} | ||
@@ -1253,0 +1251,0 @@ /** |
{ | ||
"name": "shoukaku", | ||
"version": "4.1.0", | ||
"version": "4.1.1", | ||
"description": "A stable and updated wrapper around Lavalink", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
372793
4019