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
All checks were successful
Build & Publish / build (push) Successful in 3m59s
This commit is contained in:
parent
47c05b7a7c
commit
48588ccbe9
@ -3,6 +3,7 @@ package dev.jansel.aglaea.utils
|
|||||||
import com.github.philippheuer.credentialmanager.domain.OAuth2Credential
|
import com.github.philippheuer.credentialmanager.domain.OAuth2Credential
|
||||||
import com.github.twitch4j.TwitchClientBuilder
|
import com.github.twitch4j.TwitchClientBuilder
|
||||||
import com.github.twitch4j.chat.events.channel.ChannelMessageEvent
|
import com.github.twitch4j.chat.events.channel.ChannelMessageEvent
|
||||||
|
import com.github.twitch4j.eventsub.events.ChannelPointsCustomRewardRedemptionEvent
|
||||||
import dev.jansel.aglaea.botRef
|
import dev.jansel.aglaea.botRef
|
||||||
import dev.jansel.aglaea.database.collections.ConfigCollection
|
import dev.jansel.aglaea.database.collections.ConfigCollection
|
||||||
import dev.jansel.aglaea.database.collections.ReplayCollection
|
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") {
|
twitchClient!!.eventManager.onEvent(ChannelPointsCustomRewardRedemptionEvent::class.java) { event ->
|
||||||
logger.info { "Channel points redeemed: ${event.customRewardId.get()}" }
|
if (event.id == "bd678e34-5a33-4d79-9cb0-fbb83f88a26b") {
|
||||||
|
logger.info { "Channel points redeemed: ${event.id}" }
|
||||||
logger.info { "Activating free Replays..." }
|
logger.info { "Activating free Replays..." }
|
||||||
runBlocking {
|
runBlocking {
|
||||||
launch {
|
launch {
|
||||||
@ -60,7 +63,7 @@ class Twitch : KordExKoinComponent {
|
|||||||
.getChannelOf<GuildMessageChannel>(Snowflake(1130954956892029060))
|
.getChannelOf<GuildMessageChannel>(Snowflake(1130954956892029060))
|
||||||
ConfigCollection().update(ConfigCollection().get()!!.copy(replaySession = true))
|
ConfigCollection().update(ConfigCollection().get()!!.copy(replaySession = true))
|
||||||
channel.createMessage {
|
channel.createMessage {
|
||||||
content = "Free Replays activated by: ${event.user.name}"
|
content = "Free Replays activated by: ${event.userName}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user