From 1157eb50de803af207a65ee57f69e08cebe7e4bd Mon Sep 17 00:00:00 2001 From: Jannik Reimers Date: Sun, 24 Nov 2024 03:24:01 +0100 Subject: [PATCH] use a cooler event handler for events (async) --- build.gradle.kts | 1 + gradle/libs.versions.toml | 2 +- src/main/kotlin/dev/jansel/feixiao/App.kt | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index ff252cd..f795a72 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -20,6 +20,7 @@ dependencies { implementation(libs.kx.ser) implementation(libs.kx.coroutines) implementation(libs.twitch4j) + implementation(libs.events4j) implementation(libs.kmongo) // Logging dependencies diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ce4033d..76665e0 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -22,5 +22,5 @@ logback = { module = "ch.qos.logback:logback-classic", version.ref = "logback" } logback-groovy = { module = "io.github.virtualdogbert:logback-groovy-config", version.ref = "logback-groovy" } logging = { module = "io.github.oshai:kotlin-logging", version.ref = "logging" } twitch4j = { module = "com.github.twitch4j:twitch4j", version.ref = "twitch4j" } -events4j = { module = "com.github.philippheuer.events4j:events4j-handler-simple", version.ref = "events4j" } +events4j = { module = "com.github.philippheuer.events4j:events4j-handler-reactor", version.ref = "events4j" } kmongo = { module="org.litote.kmongo:kmongo-coroutine-serialization", version.ref = "kmongo"} diff --git a/src/main/kotlin/dev/jansel/feixiao/App.kt b/src/main/kotlin/dev/jansel/feixiao/App.kt index e6fb71c..9f70fcc 100644 --- a/src/main/kotlin/dev/jansel/feixiao/App.kt +++ b/src/main/kotlin/dev/jansel/feixiao/App.kt @@ -3,6 +3,7 @@ */ package dev.jansel.feixiao +import com.github.philippheuer.events4j.reactor.ReactorEventHandler import com.github.twitch4j.TwitchClient import com.github.twitch4j.TwitchClientBuilder import com.github.twitch4j.events.ChannelGoLiveEvent @@ -31,6 +32,7 @@ suspend fun main() { .withEnableHelix(true) .withClientId(twitchcid) .withClientSecret(twitchcs) + .withDefaultEventHandler(ReactorEventHandler::class.java) .build() twitchClient!!.eventManager.onEvent(ChannelGoLiveEvent::class.java) {