diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml index d4b7acc..c224ad5 100644 --- a/.idea/kotlinc.xml +++ b/.idea/kotlinc.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/src/main/kotlin/dev/jansel/feixiao/extensions/EventHooks.kt b/src/main/kotlin/dev/jansel/feixiao/extensions/EventHooks.kt index 4f981ee..765643b 100644 --- a/src/main/kotlin/dev/jansel/feixiao/extensions/EventHooks.kt +++ b/src/main/kotlin/dev/jansel/feixiao/extensions/EventHooks.kt @@ -1,6 +1,7 @@ package dev.jansel.feixiao.extensions import com.github.twitch4j.TwitchClientBuilder +import com.github.twitch4j.events.ChannelChangeTitleEvent import com.github.twitch4j.events.ChannelGoLiveEvent import com.github.twitch4j.events.ChannelGoOfflineEvent import dev.jansel.feixiao.utils.tchannelid @@ -46,6 +47,13 @@ class EventHooks : Extension() { } } } + twitchClient.eventManager.onEvent(ChannelChangeTitleEvent::class.java) { + runBlocking { + launch { + kord.editPresence { streaming(it.title, "https://twitch.tv/${it.channel.name}") } + } + } + } } } }