1
0

imagine tracking a message event when u redeem a reward with no message input hahaha
All checks were successful
Build & Publish / build (push) Successful in 3m59s

This commit is contained in:
Jannik Reimers 2025-04-16 20:56:01 +02:00
parent 47c05b7a7c
commit 48588ccbe9
Signed by: jansel
GPG Key ID: 39C62D7D5233CFD0

View File

@ -3,6 +3,7 @@ package dev.jansel.aglaea.utils
import com.github.philippheuer.credentialmanager.domain.OAuth2Credential
import com.github.twitch4j.TwitchClientBuilder
import com.github.twitch4j.chat.events.channel.ChannelMessageEvent
import com.github.twitch4j.eventsub.events.ChannelPointsCustomRewardRedemptionEvent
import dev.jansel.aglaea.botRef
import dev.jansel.aglaea.database.collections.ConfigCollection
import dev.jansel.aglaea.database.collections.ReplayCollection
@ -50,9 +51,11 @@ class Twitch : KordExKoinComponent {
}
}
}
}
if (event.customRewardId.isPresent && event.customRewardId.get() == "bd678e34-5a33-4d79-9cb0-fbb83f88a26b") {
logger.info { "Channel points redeemed: ${event.customRewardId.get()}" }
twitchClient!!.eventManager.onEvent(ChannelPointsCustomRewardRedemptionEvent::class.java) { event ->
if (event.id == "bd678e34-5a33-4d79-9cb0-fbb83f88a26b") {
logger.info { "Channel points redeemed: ${event.id}" }
logger.info { "Activating free Replays..." }
runBlocking {
launch {
@ -60,7 +63,7 @@ class Twitch : KordExKoinComponent {
.getChannelOf<GuildMessageChannel>(Snowflake(1130954956892029060))
ConfigCollection().update(ConfigCollection().get()!!.copy(replaySession = true))
channel.createMessage {
content = "Free Replays activated by: ${event.user.name}"
content = "Free Replays activated by: ${event.userName}"
}
}
}