Extension of the official LavaLink-Client to work with Kord
Both Kord and Lavakord is still in an experimental stage, as such we can't guarantee API stability between releases. While we'd love for you to try out our library, we don't recommend you use this in production just yet.
Lavalink download: https://github.com/Frederikam/Lavalink
You can get Lavakord from here: https://package-search.jetbrains.com/package?id=me.schlaubi%3Alavakord (You need jcenter()
and jitpack though)
You can create a Lavalink
object like this
val lavalink = kord.lavalink()
// or
val lavalink = kord.lavalink {
autoReconnect = false
}
You can obtain and use a Link
like this
val link = guild.getLink(lavalink)
link.connect(channel)
// use lavalink stuff like player
link.disconnect()
Lavakord provides a wrapper for the Lavalink Track loading API
You can load a Track by using Link.loadItem(query: String)
for a couroutine based aproach or Link.loadItem(query: String, callback: AudioLoadResultHandler)
for a callback based approach like Lavaplayer
Since 0.3 Lavakord provides a Flow based way to listen for events.
val link: KordLink // = .../
val player = link.player
player.on<TrackStartEvent> {
channel.createMessage(track.info.asString())
}
For more info please use the example or Dokka docs