repositories {
...
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.ajkneisl:lib:Tag'
}
import dev.ajkneisl.lib.discord.DiscordWebhook
import kotlinx.coroutines.runBlocking
fun main() {
runBlocking {
DiscordWebhook("webhook url").sendMessage("Hello! :)")
}
}
webhooks automatically handle rate limit :)
if you want to change the log level of the rate limit notifications: (by default Level.TRACE
)
import dev.ajkneisl.lib.discord.DiscordWebhook
import org.slf4j.event.Level
fun main() {
DiscordWebhook.RATE_LIMIT_LOG_LEVEL = Level.TRACE
}
to make your webhook work with other functions of this library (ex: logging functions):
import dev.ajkneisl.lib.Lib
import dev.ajkneisl.lib.discord.DiscordWebhook
fun main() {
val myWebhook = DiscordWebhook("webhook url")
Lib.DEFAULT_WEBHOOK = myWebhook
}