diff --git a/core/src/commonMain/kotlin/cache/data/ApplicationCommandData.kt b/core/src/commonMain/kotlin/cache/data/ApplicationCommandData.kt index f925bb245b57..03a1d544f4be 100644 --- a/core/src/commonMain/kotlin/cache/data/ApplicationCommandData.kt +++ b/core/src/commonMain/kotlin/cache/data/ApplicationCommandData.kt @@ -27,9 +27,11 @@ public data class ApplicationCommandData( val version: Snowflake ) { public companion object { - public val description: DataDescription = description(ApplicationCommandData::id) { - link(ApplicationCommandData::guildId to GuildData::id) - } + public val description: DataDescription = + description(ApplicationCommandData::id) { + link(ApplicationCommandData::id to GuildApplicationCommandPermissionsData::id) + } + public fun from(command: DiscordApplicationCommand): ApplicationCommandData { return with(command) { ApplicationCommandData( diff --git a/core/src/commonMain/kotlin/cache/data/ChannelData.kt b/core/src/commonMain/kotlin/cache/data/ChannelData.kt index aca695c204f2..93df5a98f77f 100644 --- a/core/src/commonMain/kotlin/cache/data/ChannelData.kt +++ b/core/src/commonMain/kotlin/cache/data/ChannelData.kt @@ -49,7 +49,12 @@ public data class ChannelData( public companion object { - public val description: DataDescription = description(ChannelData::id) + public val description: DataDescription = description(ChannelData::id) { + link(ChannelData::id to MessageData::channelId) + link(ChannelData::id to ThreadMemberData::id) + link(ChannelData::id to WebhookData::channelId) + link(ChannelData::id to VoiceStateData::channelId) + } public fun from(entity: DiscordChannel): ChannelData = with(entity) { ChannelData( diff --git a/core/src/commonMain/kotlin/cache/data/GuildApplicationCommandPermissionsData.kt b/core/src/commonMain/kotlin/cache/data/GuildApplicationCommandPermissionsData.kt index 3a74d2835a86..8472c629b656 100644 --- a/core/src/commonMain/kotlin/cache/data/GuildApplicationCommandPermissionsData.kt +++ b/core/src/commonMain/kotlin/cache/data/GuildApplicationCommandPermissionsData.kt @@ -14,10 +14,7 @@ public data class GuildApplicationCommandPermissionsData( public companion object { public val description: DataDescription = - description(GuildApplicationCommandPermissionsData::id) { - link(GuildApplicationCommandPermissionsData::guildId to GuildData::id) - link(GuildApplicationCommandPermissionsData::id to ApplicationCommandData::id) - } + description(GuildApplicationCommandPermissionsData::id) public fun from(permissions: DiscordGuildApplicationCommandPermissions): GuildApplicationCommandPermissionsData = with(permissions) { diff --git a/core/src/commonMain/kotlin/cache/data/GuildData.kt b/core/src/commonMain/kotlin/cache/data/GuildData.kt index 36c3beababd5..59abb143573a 100644 --- a/core/src/commonMain/kotlin/cache/data/GuildData.kt +++ b/core/src/commonMain/kotlin/cache/data/GuildData.kt @@ -8,9 +8,11 @@ import dev.kord.common.serialization.DurationInSeconds import kotlinx.datetime.Instant import kotlinx.serialization.Serializable +private val ApplicationCommandData.nullableGuildId get() = guildId.value private val MessageData.nullableGuildId get() = guildId.value private val ChannelData.nullableGuildId get() = guildId.value private val WebhookData.nullableGuildId get() = guildId.value +private val StickerData.nullableGuildId get() = guildId.value @Serializable public data class GuildData( @@ -71,7 +73,8 @@ public data class GuildData( public companion object { public val description: DataDescription = description(GuildData::id) { - + link(GuildData::id to ApplicationCommandData::nullableGuildId) + link(GuildData::id to GuildApplicationCommandPermissionsData::guildId) link(GuildData::id to RoleData::guildId) link(GuildData::id to ChannelData::nullableGuildId) link(GuildData::id to MemberData::guildId) @@ -79,6 +82,8 @@ public data class GuildData( link(GuildData::id to WebhookData::nullableGuildId) link(GuildData::id to VoiceStateData::guildId) link(GuildData::id to PresenceData::guildId) + link(GuildData::id to StickerData::nullableGuildId) + link(GuildData::id to EmojiData::guildId) link(GuildData::id to AutoModerationRuleData::guildId) } diff --git a/core/src/commonMain/kotlin/cache/data/StickerData.kt b/core/src/commonMain/kotlin/cache/data/StickerData.kt index a1882a87ca7c..b994ef1a9867 100644 --- a/core/src/commonMain/kotlin/cache/data/StickerData.kt +++ b/core/src/commonMain/kotlin/cache/data/StickerData.kt @@ -24,11 +24,7 @@ public data class StickerData( ) { public companion object { - public val description: DataDescription = description(StickerData::id) { - link(StickerData::guildId to GuildData::id) - link(StickerData::packId to StickerPackData::id) - } - + public val description: DataDescription = description(StickerData::id) public fun from(entity: DiscordMessageSticker): StickerData = with(entity) { StickerData(id, packId, name, description, tags, formatType, available, guildId, user.map { it.toData() }, sortValue) @@ -49,6 +45,7 @@ public data class StickerItemData( } } +private val StickerData.nullablePackId get() = packId.value public data class StickerPackData( val id: Snowflake, @@ -58,13 +55,15 @@ public data class StickerPackData( val coverStickerId: OptionalSnowflake = OptionalSnowflake.Missing, val description: String, val bannerAssetId: Snowflake - ) { +) { public companion object { - public val description: DataDescription = description(StickerPackData::id) + public val description: DataDescription = description(StickerPackData::id) { + link(StickerPackData::id to StickerData::nullablePackId) + } public fun from(entity: DiscordStickerPack): StickerPackData = with(entity) { StickerPackData(id, stickers.map { StickerData.from(it) }, name, skuId, coverStickerId, description, bannerAssetId) } } -} \ No newline at end of file +} diff --git a/core/src/commonMain/kotlin/cache/data/UserData.kt b/core/src/commonMain/kotlin/cache/data/UserData.kt index 3e5ceb5a1f54..64e35b3ad914 100644 --- a/core/src/commonMain/kotlin/cache/data/UserData.kt +++ b/core/src/commonMain/kotlin/cache/data/UserData.kt @@ -10,7 +10,7 @@ import dev.kord.common.entity.optional.Optional import dev.kord.common.entity.optional.OptionalBoolean import kotlinx.serialization.Serializable -private val WebhookData.nullableUserId get() = userId.value +private val ThreadMemberData.nullableUserId get() = userId.value @Serializable public data class UserData( @@ -29,7 +29,7 @@ public data class UserData( public val description: DataDescription = description(UserData::id) { link(UserData::id to MemberData::userId) - link(UserData::id to WebhookData::nullableUserId) + link(UserData::id to ThreadMemberData::nullableUserId) link(UserData::id to VoiceStateData::userId) link(UserData::id to PresenceData::userId) }