diff --git a/src/core/Player.ts b/src/core/Player.ts index ee9257b7..3c01d575 100644 --- a/src/core/Player.ts +++ b/src/core/Player.ts @@ -86,7 +86,7 @@ export class Player extends EventEmitter { return this.node.voiceServers.get(this.guildID) ?? null; } - public async moveTo(node: BaseNode) { + public async moveTo(node: BaseNode): Promise { if (this.node === node) return; const { voiceState, voiceServer } = this; @@ -96,11 +96,11 @@ export class Player extends EventEmitter { await Promise.all([node.voiceStateUpdate(voiceState), node.voiceServerUpdate(voiceServer)]); } - public leave() { + public leave(): Promise { return this.join(null); } - public join(channel: string | null, { deaf = false, mute = false }: JoinOptions = {}) { + public join(channel: string | null, { deaf = false, mute = false }: JoinOptions = {}): Promise { this.node.voiceServers.delete(this.guildID); this.node.voiceStates.delete(this.guildID); @@ -117,7 +117,7 @@ export class Player extends EventEmitter { return this.node.send(this.guildID, data); } - public async play(track: string | Track, { start, end, noReplace, pause }: PlayerOptions = {}) { + public async play(track: string | Track, { start, end, noReplace, pause }: PlayerOptions = {}): Promise { await this.send({ op: 'play', guildId: this.guildID, @@ -132,7 +132,12 @@ export class Player extends EventEmitter { else this.status = Status.Playing; } - public setFilters(options: FilterOptions) { + /** + * Sets the filters for the player. + * @note This is not available in Lavalink v3.3. + * @param options The filters to be sent. + */ + public setFilters(options: FilterOptions): Promise { return this.send({ op: 'filters', guildId: this.guildID, @@ -141,22 +146,28 @@ export class Player extends EventEmitter { } /** - * @deprecated Please use `setFilters({ volume })` instead. * @param volume The new volume to be set. */ - public setVolume(volume: number) { - return this.setFilters({ volume }); + public setVolume(volume: number): Promise { + return this.send({ + op: 'volume', + guildId: this.guildID, + volume + }); } /** - * @deprecated Please use `setFilters({ bands })` instead. * @param equalizer The equalizer bads to be set. */ - public setEqualizer(equalizer: readonly EqualizerBand[]) { - return this.setFilters({ equalizer }); + public setEqualizer(equalizer: readonly EqualizerBand[]): Promise { + return this.send({ + op: 'equalizer', + guildId: this.guildID, + bands: equalizer + }); } - public seek(position: number) { + public seek(position: number): Promise { return this.send({ op: 'seek', guildId: this.guildID, @@ -164,7 +175,7 @@ export class Player extends EventEmitter { }); } - public async pause(pause = true) { + public async pause(pause = true): Promise { await this.send({ op: 'pause', guildId: this.guildID, @@ -175,7 +186,7 @@ export class Player extends EventEmitter { else this.status = Status.Playing; } - public async stop() { + public async stop(): Promise { await this.send({ op: 'stop', guildId: this.guildID @@ -184,7 +195,7 @@ export class Player extends EventEmitter { this.status = Status.Ended; } - public async destroy() { + public async destroy(): Promise { if (this.node.connected) { await this.send({ op: 'destroy', @@ -195,7 +206,7 @@ export class Player extends EventEmitter { this.node.players.delete(this.guildID); } - public voiceUpdate(sessionId: string, event: VoiceServerUpdate) { + public voiceUpdate(sessionId: string, event: VoiceServerUpdate): Promise { return this.send({ op: 'voiceUpdate', guildId: this.guildID, @@ -204,7 +215,7 @@ export class Player extends EventEmitter { }); } - public send(data: OutgoingPayload) { + public send(data: OutgoingPayload): Promise { const conn = this.node.connection; if (conn) return conn.send(data); return Promise.reject(new Error('no WebSocket connection available')); diff --git a/src/types/OutgoingPayloads.ts b/src/types/OutgoingPayloads.ts index 9c711655..947f9856 100644 --- a/src/types/OutgoingPayloads.ts +++ b/src/types/OutgoingPayloads.ts @@ -89,9 +89,6 @@ export interface OutgoingVoiceUpdatePayload extends BaseOutgoingPayload { event: VoiceServerUpdate; } -/** - * @deprecated Use `OutgoingFilterPayload` instead. - */ export interface OutgoingVolumePayload extends BaseOutgoingPayload { op: 'volume'; @@ -114,14 +111,11 @@ export interface EqualizerBand { * The multiplier of the band. Valid values range from -0.25 to 1.0, where -0.25 means the given band is * completely muted, and 0.25 means it is doubled. Modifying the gain could also change the volume of the output. * @default 0 - * @range [-0.25, -1] + * @range [-0.25, 1] */ gain: number; } -/** - * @deprecated Use `OutgoingFilterPayload` instead. - */ export interface OutgoingEqualizerPayload extends BaseOutgoingPayload { op: 'equalizer'; @@ -146,11 +140,16 @@ export interface OutgoingConfigureResumingPayload { timeout?: number; } +/** + * @note This is not available in Lavalink v3.3. + */ export interface OutgoingFilterPayload extends BaseOutgoingPayload { op: 'filters'; /** - * The volume to set the track. + * The volume to set the track. Valid values range from 0 to 5.0, where 0 means the stream is completely muted, and + * 2 means it is doubled. + * @range [0, 5] */ volume?: number; @@ -192,6 +191,9 @@ export interface OutgoingFilterPayload extends BaseOutgoingPayload { rotation?: RotationOptions; } +/** + * @note This is not available in Lavalink v3.3. + */ export interface KaraokeOptions { /** * The level. @@ -218,6 +220,9 @@ export interface KaraokeOptions { filterWidth?: number; } +/** + * @note This is not available in Lavalink v3.3. + */ export interface TimescaleOptions { /** * The speed of the track. Must be >=0. @@ -238,6 +243,9 @@ export interface TimescaleOptions { rate?: number; } +/** + * @note This is not available in Lavalink v3.3. + */ export interface FrequencyDepthOptions { /** * The frequency to edit. Must be >0 and <=14. @@ -252,6 +260,9 @@ export interface FrequencyDepthOptions { depth?: number; } +/** + * @note This is not available in Lavalink v3.3. + */ export interface DistortionOptions { /** * The sine's offset. @@ -302,6 +313,9 @@ export interface DistortionOptions { scale?: number; } +/** + * @note This is not available in Lavalink v3.3. + */ export interface RotationOptions { /** * The frequency in Hz to rotate.