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

commonMain.entity.GuildPreview.kt Maven / Gradle / Ivy

There is a newer version: 0.15.0
Show newest version
package dev.kord.core.entity

import dev.kord.common.entity.GuildFeature
import dev.kord.common.entity.Snowflake
import dev.kord.core.Kord
import dev.kord.core.cache.data.GuildPreviewData

public class GuildPreview(
    public val data: GuildPreviewData,
    override val kord: Kord
) : KordEntity {

    override val id: Snowflake
        get() = data.id

    /**
     * The name of the guild.
     */
    public val name: String get() = data.name

    /**
     * Icon hash.
     */
    public val icon: String? get() = data.icon

    /**
     * Splash hash.
     */
    public val splash: String? get() = data.splash

    /**
     * Discovery splash hash.
     */
    public val discoverySplash: String? get() = data.discoverySplash

    /**
     * Custom guild emojis.
     */
    public val emojis: Set get() = data.emojis.map { GuildEmoji(it, kord) }.toSet()

    /**
     * Enabled guild features.
     */
    public val features: Set get() = data.features.toSet()

    /**
     * Approximate number of members in this guild.
     */
    public val approximateMemberCount: Int get() = data.approximateMemberCount

    /**
     * Approximate number of online members in this guild.
     */
    public val approximatePresenceCount: Int get() = data.approximatePresenceCount

    /**
     * The description for the guild.
     */
    public val description: String? get() = data.description

    /**
     * Custom guild stickers.
     */
    public val stickers: Set get() = data.stickers.map { GuildSticker(it, kord) }.toSet()

    override fun toString(): String {
        return "GuildPreview(data=$data, kord=$kord)"
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy