commonMain.cache.data.PresenceData.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kord-core Show documentation
Show all versions of kord-core Show documentation
Idiomatic Kotlin Wrapper for The Discord API
The newest version!
package dev.kord.core.cache.data
import dev.kord.cache.api.data.DataDescription
import dev.kord.cache.api.data.description
import dev.kord.common.entity.*
import kotlinx.serialization.Serializable
public val PresenceData.id: String get() = "$userId$guildId"
@Serializable
public data class PresenceData(
val userId: Snowflake,
val guildId: Snowflake,
val status: PresenceStatus,
val activities: List,
val clientStatus: ClientStatusData,
) {
public companion object {
public val description: DataDescription = description(PresenceData::id)
public fun from(guildId: Snowflake, entity: DiscordPresenceUpdate): PresenceData = with(entity) {
PresenceData(
user.id,
guildId,
status,
activities.map { ActivityData.from(it) },
ClientStatusData.from(clientStatus),
)
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy