add free replay redeem, one change comes later if its working right

This commit is contained in:
Jannik Reimers 2025-04-16 11:02:26 +02:00
parent 7f2641c7bb
commit 1177e3ad29
Signed by: jansel
GPG key ID: 39C62D7D5233CFD0
10 changed files with 563 additions and 694 deletions

View file

@ -43,7 +43,7 @@ class SessionExtension : Extension() {
ConfigCollection().update(ConfigCollection().get()!!.copy(replaySession = true))
}
channel.createMessage {
content = "Replay session enabled by: ${event.interaction.user.globalName}. SEND UR REPLAYS FOR FREE!"
content = "<@&1361987241609527308> Replay session enabled by: ${event.interaction.user.globalName}. SEND UR REPLAYS FOR FREE!"
}
respond {
content = "Replay session enabled"

View file

@ -4,6 +4,7 @@ import com.github.philippheuer.credentialmanager.domain.OAuth2Credential
import com.github.twitch4j.TwitchClientBuilder
import com.github.twitch4j.chat.events.channel.ChannelMessageEvent
import dev.jansel.aglaea.botRef
import dev.jansel.aglaea.database.collections.ConfigCollection
import dev.jansel.aglaea.database.collections.ReplayCollection
import dev.jansel.aglaea.logger
import dev.jansel.aglaea.twitchClient
@ -49,6 +50,22 @@ class Twitch : KordExKoinComponent {
}
}
}
if (event.customRewardId.get() == "bd678e34-5a33-4d79-9cb0-fbb83f88a26b") {
logger.info { "Channel points redeemed: ${event.customRewardId.get()}" }
logger.info { "Activating free Replays..." }
runBlocking {
launch {
val channel = botRef!!.kordRef.getGuildOrNull(Snowflake(1130932838200512584))!!
.getChannelOf<GuildMessageChannel>(Snowflake(1130954956892029060))
ConfigCollection().update(ConfigCollection().get()!!.copy(replaySession = true))
channel.createMessage {
content = "Free Replays activated by: ${event.user.name}"
}
}
}
logger.info { "Free Replays activated!" }
}
}
}
}