RevoltKt
A pure-Kotlin library for bots to interface with Revolt
Sample Usage
import me.maya.revolt.defaultClientBuilder
import me.maya.revolt.events.Event
import me.maya.revolt.events.EventHandler
import me.maya.revolt.registerEventHandler
import me.maya.revolt.setErrorCallback
import me.maya.revolt.token
val token = System.getenv("TOKEN")
fun main() {
val client = defaultClientBuilder {
token(token)
registerEventHandler(object: EventHandler() {
override suspend fun onMessage(event: Event.Message) {.
println("Received ${event.message.content} from ${event.message.author.username}")
if (event.message.author.id == "my_owner_id") client.close()
}
})
setErrorCallback { event, error ->
println("Error occured in event $event")
error.printStackTrace()
}
}.build()
client.runForever()
}
Installation
Gradle is confusing. I know, I've used it for too long. You can download my sample repo for quick setup and use!
Or if you'd rather, you can download the artifacts from GitHub releases and add them manually:
dependencies {
implementation(files("Revolt-0.1.1-full.jar"))
// `full` contains all dependencies (ktor, kotlin-reflect etc)
// If needed, you can use `Revolt-0.1.1.jar` for a version without dependencies
}
Support
I have a Revolt support server you are welcome to join and ask for help. There I will post announcements as well.
Contributing
This project is completely open source! As long as you have an idea, feel free to make a pull request. Be sure to test it before hand.