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

commonMain.cache.data.PartialGuildData.kt Maven / Gradle / Ivy

The newest version!
package dev.kord.core.cache.data

import dev.kord.common.entity.*
import dev.kord.common.entity.optional.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
public class PartialGuildData(
    public val id: Snowflake,
    public val name: String,
    public val icon: String? = null,
    public val owner: OptionalBoolean = OptionalBoolean.Missing,
    public val permissions: Optional = Optional.Missing(),
    public val features: List,
    public val welcomeScreen: Optional = Optional.Missing(),
    @SerialName("vanity_url_code") public val vanityUrlCode: Optional = Optional.Missing(),
    public val description: Optional = Optional.Missing(),
    public val banner: Optional = Optional.Missing(),
    public val splash: Optional = Optional.Missing(),
    @SerialName("nsfw_level") public val nsfwLevel: Optional = Optional.Missing(),
    @SerialName("verification_level")
    public val verificationLevel: Optional = Optional.Missing(),
    public val stageInstances: Optional> = Optional.Missing(),
    public val stickers: Optional> = Optional.Missing(),
    public val guildScheduledEvents: Optional> = Optional.Missing(),
    public val approximateMemberCount: OptionalInt = OptionalInt.Missing,
    public val approximatePresenceCount: OptionalInt = OptionalInt.Missing,
    public val premiumProgressBarEnabled: OptionalBoolean = OptionalBoolean.Missing
) {
    public companion object {
        public fun from(partialGuild: DiscordPartialGuild): PartialGuildData = with(partialGuild) {
            PartialGuildData(
                id,
                name,
                icon,
                owner,
                permissions,
                features,
                welcomeScreen.map { WelcomeScreenData.from(it) },
                vanityUrlCode,
                description,
                banner,
                splash,
                nsfwLevel,
                verificationLevel,
                stageInstances = stageInstances.mapList { StageInstanceData.from(it) },
                stickers = stickers.mapList { StickerData.from(it) },
                guildScheduledEvents = guildScheduledEvents.mapList { GuildScheduledEventData.from(it) },
                approximateMemberCount = approximateMemberCount,
                approximatePresenceCount = approximatePresenceCount,
                premiumProgressBarEnabled = premiumProgressBarEnabled
            )
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy