Player

interface Player : EventSource<Event>

Interface allowing interaction with Lavalink player.

Properties

Link copied to clipboard
abstract val coroutineScope: CoroutineScope

the default CoroutineScope to launch listeners in

Link copied to clipboard
abstract val equalizers: Map<Int, Float>

the applied equalizers in this player

Link copied to clipboard
abstract val events: Flow<Event>

a Flow of events

Link copied to clipboard
abstract val filters: Filters

The current Filters settings.

Link copied to clipboard

Returns the guildId for a Player.

Link copied to clipboard

Retrieves the RestNode behind a Player.

Link copied to clipboard
abstract val paused: Boolean

whether the playback is currently paused or not

Link copied to clipboard
abstract val playingTrack: Track?

the currently playing Track

Link copied to clipboard
open val position: Long

the position of the current song the player is at (or negative if playingTrack is null). Capped at the track length.

Link copied to clipboard

the position of the current song the player is at (or negative if playingTrack is null). Capped at the track length.

Link copied to clipboard
abstract val volume: Int

the current volume of this player

Functions

Link copied to clipboard
suspend fun Player.applyFilters(block: Filters.() -> Unit)

Applies all Filters to this player.

Link copied to clipboard
inline fun <T : Any, E : T> EventSource<T>.on(scope: CoroutineScope = coroutineScope, noinline consumer: suspend E.() -> Unit): Job

Convenience method that will invoke the consumer on every event T created by EventSource.events.

inline fun <T : Event> EventSource<Event>.on(scope: CoroutineScope = coroutineScope, noinline consumer: suspend T.() -> Unit): Job

Listens for a TrackEvent

Link copied to clipboard
abstract suspend fun pause(doPause: Boolean = true)

Pauses/unpauses playback of the current track.

Link copied to clipboard
open suspend fun playTrack(track: Track, playOptionsBuilder: PlayOptions.() -> Unit = {})
abstract suspend fun playTrack(track: String, playOptionsBuilder: PlayOptions.() -> Unit = {})

Changes the currently playing track to track.

Link copied to clipboard
suspend fun Player.resetFilters()

Resets all applied filters.

Link copied to clipboard
abstract suspend fun searchAndPlayTrack(identifier: String, playOptionsBuilder: PlayOptions.() -> Unit)

Directly plays a single track.

Link copied to clipboard
abstract suspend fun seekTo(position: Long)
open suspend fun seekTo(position: Duration)

Seeks to a specific position in the current playback.

Link copied to clipboard
abstract suspend fun stopTrack()

Stops playback of the currently playing track.

Link copied to clipboard
open suspend fun unPause()

Unpauses the playback