All Projects → DRSchlaubi → Lavalink.kt

DRSchlaubi / Lavalink.kt

Licence: MIT license
Coroutine based client for Lavalink (Kotlin and Java)

Programming Languages

kotlin
9241 projects
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Lavalink.kt

Sheasy
This an Android App that helps you share/manage your files on your Android Device through a WebInterface in the Browser - Built with Ktor and Kotlin-React
Stars: ✭ 34 (+9.68%)
Mutual labels:  kotlin-js, ktor
tmdb-api
This Kotlin Multiplatform library is for accessing the TMDB API to get movie and TV show content. Using for Android, iOS, and JS projects.
Stars: ✭ 31 (+0%)
Mutual labels:  kotlin-js, ktor
intro-kotlin-mutliplatform
Kotlin Multiplatform project (MPP), JVM and JS
Stars: ✭ 21 (-32.26%)
Mutual labels:  kotlin-js, ktor
thelema-engine
Thelema - 3D graphics engine, written in Kotlin. Based on sources of libGDX.
Stars: ✭ 51 (+64.52%)
Mutual labels:  kotlin-js
Maily-Form
Forms on any website
Stars: ✭ 29 (-6.45%)
Mutual labels:  kotlin-js
CleanArchitecture
Kotlin backend based on the Clean Architecture principles. Ktor, JWT, Exposed, Flyway, OpenAPI/REST & KGraphQL/GraphQL generated endpoints, Gradle.
Stars: ✭ 271 (+774.19%)
Mutual labels:  ktor
Discord Music Bot
Discord Music Bot. Play, Playlist, Welcome and Administrative commands.
Stars: ✭ 18 (-41.94%)
Mutual labels:  lavalink
super-github
Enhance your GitHub experience 🚀
Stars: ✭ 18 (-41.94%)
Mutual labels:  kotlin-js
heroku-lavalink
Deploy lavalink on heroku.
Stars: ✭ 46 (+48.39%)
Mutual labels:  lavalink
KotlinMultiplatformAndoridParcelize
Use the Parcelize Annotation of the Kotlin Android Extensions in Kotin Multiplatform projects
Stars: ✭ 16 (-48.39%)
Mutual labels:  kotlin-js
github-profile
See Your Github Profile Summary
Stars: ✭ 21 (-32.26%)
Mutual labels:  ktor
mui-kotlin
Kotlin/JS support for Material-UI
Stars: ✭ 25 (-19.35%)
Mutual labels:  kotlin-js
api-service
The REST API backend server for the Jalgaon CoHelp application. Built with Kotlin Ktor.
Stars: ✭ 26 (-16.13%)
Mutual labels:  ktor
three-kt-wrapper
Kotlin wrappers for Three.js
Stars: ✭ 46 (+48.39%)
Mutual labels:  kotlin-js
sample-kotlin-ktor-microservices
sample microservices written in Kotlin that demonstrates usage of Ktor framework woth Consul server
Stars: ✭ 37 (+19.35%)
Mutual labels:  ktor
kfc-plugins
Kotlin/JS Fast Configuration
Stars: ✭ 37 (+19.35%)
Mutual labels:  kotlin-js
patternfly-fritz2
Pure Kotlin implementation of PatternFly
Stars: ✭ 31 (+0%)
Mutual labels:  kotlin-js
kotlin-js-D3js-example
A simple example of a D3 JavaScript program in Kotlin
Stars: ✭ 13 (-58.06%)
Mutual labels:  kotlin-js
Scout
Scout is a kotlin multiplatform application that allows users to search and save games to lists to be browsed later.
Stars: ✭ 28 (-9.68%)
Mutual labels:  ktor
kotlin-telegram
Repository with information about Kotlin chats on Telegram.
Stars: ✭ 21 (-32.26%)
Mutual labels:  kotlin-js

Lavalink.kt

Lavakord is a coroutine based client for LavaLink mainly designed to work with Kord

Support discord: https://discord.gg/ZbmrRVpDwR

Both Kord and Lavalink.kt are 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/freyacodes/Lavalink

Download

You can get Lavakord from here: https://search.maven.org/search?q=dev.schlaubi.lavakord

Usage

You can create a Lavalink object like this

val lavalink = kord.lavakord()

// or    

val lavalink = kord.lavakord {
    link {
        autoReconnect = false
        retry = linear(2.seconds, 60.seconds, 10)
    }
}

You can obtain and use a Link like this

val link = guild.getLink(lavalink)

link.connect(channel)

// use lavalink stuff like player

link.disconnect()

Playing: https://github.com/DRSchlaubi/Lavalink.kt/blob/main/example/src/main/kotlin/me/schlaubi/lavakord/example/Lavakord.kt#L82

Track loading

Lavakord provides a wrapper for the Lavalink Track loading API

You can load a Track by using Link.loadItem(query: String)

Events

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())
}

Documentation

For more info please use the example or Dokka docs

Multiplatform

Since Lavakord 1.0 we use only Multiplatform Kotlin libraries but Ktor doesn't support Websockets when using Kotlin native yet see kordlib/kord#69 and ktorio/ktor#1215 for reference. Kord doesn't support Multiplatform because of the same issue as well

Since 2.0 JS is officially supported

Other Discord API wrappers

Since 1.0 it should be possible to implement your own version of lavakord by implementing your own versions of the LavaKord and Link classes you can see a reference implementation in the kord package

Using with Kord

Add the kord artifact

Using with JDA

Apart from Kord there also is a JDA implementation. You can use it like the following. (Requires jda artifact)

var (lavakord, jda) = JDABuilder.createDefault("token").buildWithLavakord()
class Javakord {
    var container = new LavakordJDABuilder(JDABuilder.createDefault("token")).build();
    var jda = container.getJda();
    var lavakord = container.getLavakord();
    JavaLavakord javaLavakord = JavaInterop.createJavaInterface(lavakord);
}

The snippets work similarly for DefaultShardManagerBuilder as well.

Using with Java

Lavakord provides a compatibility layer for coroutines based on Java 8's CompletableFuture API . To access that interface please use the JavaInterop class. For all rest related features refer to the TrackUtil and RoutePlannerUtil classes. In order to use these methods please add the java or jda-java artifact

Full example can be found here

class Javakord {
    Lavakord lavakord;// = <lavakord build mechanism>
    JavaLavakord javaLavakord = JavaInterop.createJavaInterface(lavakord);
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].