even more grrrr

This commit is contained in:
Jannik Reimers 2025-05-02 03:38:00 +02:00
parent bb5b124b33
commit 5550016d79
Signed by: jansel
GPG key ID: 39C62D7D5233CFD0
3 changed files with 6 additions and 3 deletions

View file

@ -1,11 +1,14 @@
package dev.jansel.aglaea.database.entities package dev.jansel.aglaea.database.entities
import dev.kord.common.entity.Snowflake
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
@Serializable @Serializable
data class ReplayData( data class ReplayData(
val id: String, val id: String,
val replayFile: ByteArray, val replayFile: ByteArray,
val submitTime: Long,
val userId: Snowflake,
) { ) {
override fun equals(other: Any?): Boolean { override fun equals(other: Any?): Boolean {
if (this === other) return true if (this === other) return true

View file

@ -57,13 +57,13 @@ class ReplayExtension : Extension() {
if (file.filename.endsWith(".osr")) { if (file.filename.endsWith(".osr")) {
val id = Uuid.random().toString() val id = Uuid.random().toString()
ReplayCollection().set(ReplayData(id, file.download())) ReplayCollection().set(ReplayData(id, file.download(), System.currentTimeMillis(), event.interaction.user.id))
respond { respond {
content = "Your Auth Code is: $id" content = "Your Auth Code is: $id"
} }
} else { } else {
respond { respond {
content = "" content = "Invalid Replay file."
} }
} }
} }

View file

@ -44,7 +44,7 @@ class Twitch : KordExKoinComponent {
.getChannelOf<GuildMessageChannel>(Snowflake(1130954956892029060)) .getChannelOf<GuildMessageChannel>(Snowflake(1130954956892029060))
val replay = ReplayCollection().get(event.message) ?: return@launch val replay = ReplayCollection().get(event.message) ?: return@launch
channel.createMessage { channel.createMessage {
content = "Replay redeemed by: ${event.user.name}" content = "Replay redeemed by: ${event.user.name}, submitted to the Database at <t:${replay.submitTime / 1000}> by <@${replay.userId}>"
this.addFile("replay.osr", ChannelProvider(null) { ByteReadChannel(replay.replayFile) }) this.addFile("replay.osr", ChannelProvider(null) { ByteReadChannel(replay.replayFile) })
} }
// remove the replay from the database // remove the replay from the database