All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.entity.interaction.ResolvedObjects.kt Maven / Gradle / Ivy

There is a newer version: 0.15.0
Show newest version
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
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy