Node

interface Node : RestNode, EventSource<Event> , Closeable

Representation of a Lavalink node, supporting rest calls and a websocket connection.

Properties

Link copied to clipboard

The password for communicating with the node.

Link copied to clipboard
abstract val available: Boolean

Whether this node is currently available or not (e.g. reconnecting).

Link copied to clipboard
abstract val coroutineScope: CoroutineScope

the default CoroutineScope to launch listeners in

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

a Flow of events

Link copied to clipboard
abstract val host: Url

The host of the node.

Link copied to clipboard
Link copied to clipboard
abstract val lastStatsEvent: Stats?

The last StatsEvent received from this node or null if no event has been received yet.

Link copied to clipboard
abstract val lavakord: LavaKord

The LavaKord instance which created this node.

Link copied to clipboard
abstract val name: String

The name of the node.

Link copied to clipboard
abstract val sessionId: String

The id of the current websocket session.

Functions

Link copied to clipboard
suspend fun RestNode.addressStatus(): RoutePlannerStatus

Retrieves the current address status of the route planner api.

Link copied to clipboard
suspend fun RestNode.addressStatusOrNull(): RoutePlannerStatus?

} Retrieves the current address status of the route planner api. Can be null if no Route planner is set

Link copied to clipboard
abstract fun close()
Link copied to clipboard
suspend fun RestNode.decodeTrack(base64: String): Track

Decodes a base64 encoded Lavalink track to a Track.

Link copied to clipboard
suspend fun RestNode.decodeTracks(tracks: Iterable<String>): List<Track>

Decodes a list of base64 encoded Lavalink track to a Track.

Link copied to clipboard
inline suspend fun <T, Resource : Any> RestNode.delete(resource: Resource): T
Link copied to clipboard
suspend fun Node.destroyPlayer(guildId: ULong)
suspend fun RestNode.destroyPlayer(guildId: ULong, sessionId: String)

Destroys the player for this guild in this session.

Link copied to clipboard
inline suspend fun <T, Resource : Any> RestNode.get(resource: Resource, builder: HttpRequestBuilder.() -> Unit = {}): T
Link copied to clipboard
suspend fun RestNode.getInfo(): Info

Request Lavalink information.

Link copied to clipboard
suspend fun Node.getPlayer(guildId: ULong): Player
suspend fun RestNode.getPlayer(guildId: ULong, sessionId: String): Player

Returns the Player for this guild in this session.

Link copied to clipboard
suspend fun RestNode.getStats(): Stats
Link copied to clipboard
suspend fun RestNode.getVersion(): String

Returns the plain version string of the Lavalink Server.

Link copied to clipboard
suspend fun RestNode.loadItem(query: String): LoadResult

Loads an audio item from this Link.

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
inline suspend fun <T, Resource : Any> RestNode.patch(resource: Resource, block: HttpRequestBuilder.() -> Unit): T
Link copied to clipboard
inline suspend fun <T, Resource : Any> RestNode.post(resource: Resource, block: HttpRequestBuilder.() -> Unit = {}): T
Link copied to clipboard
inline suspend fun <T, Resource : Any> RestNode.put(resource: Resource, block: HttpRequestBuilder.() -> Unit): T
Link copied to clipboard
inline suspend fun <T, Resource : Any> RestNode.request(method: HttpMethod, resource: Resource, builder: HttpRequestBuilder.() -> Unit = {}): T
Link copied to clipboard
inline suspend fun <T, Resource : Any> RestNode.requestWithBody(method: HttpMethod, resource: Resource, builder: HttpRequestBuilder.() -> Unit = {}): T
Link copied to clipboard
suspend fun RestNode.unmarkAddress(address: String)

Unmarks the route planner address.

Link copied to clipboard

Unmarks all failed route planner addresses.

Link copied to clipboard
suspend fun Node.updatePlayer(guildId: ULong, noReplace: Boolean? = null, request: PlayerUpdate): Player
suspend fun RestNode.updatePlayer(guildId: ULong, sessionId: String, noReplace: Boolean? = null, request: PlayerUpdate): Player

Updates or creates the player for this guild if it doesn't already exist.

Link copied to clipboard
suspend fun Node.updateSession(request: SessionUpdate): Session
suspend fun RestNode.updateSession(sessionId: String, request: SessionUpdate): Session

Updates the current session.