commonMain.entity.interaction.ResolvedObjects.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
package dev.kord.core.entity.interaction
import dev.kord.common.entity.Snowflake
import dev.kord.core.Kord
import dev.kord.core.cache.data.ResolvedObjectsData
import dev.kord.core.entity.*
import dev.kord.core.entity.channel.ResolvedChannel
import dev.kord.core.supplier.EntitySupplyStrategy
import dev.kord.common.entity.optional.mapValues
public class ResolvedObjects(
public val data: ResolvedObjectsData,
public val kord: Kord,
public val strategy: EntitySupplyStrategy<*> = kord.resources.defaultStrategy,
) {
public val channels: Map?
get() = data.channels.mapValues { ResolvedChannel(it.value, kord, strategy) }.value
public val roles: Map? get() = data.roles.mapValues { Role(it.value, kord) }.value
public val users: Map? get() = data.users.mapValues { User(it.value, kord) }.value
public val members: Map?
get() = data.members.mapValues { Member(it.value, users!![it.key]!!.data, kord) }.value
public val messages: Map?
get() = data.messages.mapValues { Message(it.value, kord) }.value
public val attachments: Map?
get() = data.attachments.mapValues { Attachment(it.value, kord) }.value
}