1
0

account for title changes

This commit is contained in:
Jannik Reimers 2024-10-29 23:23:46 +01:00
parent bb49c2d29d
commit aac9e6d1c6
Signed by: jansel
GPG Key ID: 39C62D7D5233CFD0
2 changed files with 9 additions and 1 deletions

2
.idea/kotlinc.xml generated
View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="KotlinJpsPluginSettings"> <component name="KotlinJpsPluginSettings">
<option name="version" value="2.0.20" /> <option name="version" value="2.0.21" />
</component> </component>
</project> </project>

View File

@ -1,6 +1,7 @@
package dev.jansel.feixiao.extensions package dev.jansel.feixiao.extensions
import com.github.twitch4j.TwitchClientBuilder import com.github.twitch4j.TwitchClientBuilder
import com.github.twitch4j.events.ChannelChangeTitleEvent
import com.github.twitch4j.events.ChannelGoLiveEvent import com.github.twitch4j.events.ChannelGoLiveEvent
import com.github.twitch4j.events.ChannelGoOfflineEvent import com.github.twitch4j.events.ChannelGoOfflineEvent
import dev.jansel.feixiao.utils.tchannelid 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}") }
}
}
}
} }
} }
} }