diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt index 5f17610e37..71c89d90e6 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt @@ -493,9 +493,16 @@ const val creatorField = "creator" const val subscriptionPeriodField = "subscription_period" const val subscriptionPriceField = "subscription_price" const val copyTextField = "copy_text" + const val giftField = "gift" const val giftsField = "gifts" const val rarityPerMilleField = "rarity_per_mille" +const val acceptedGiftTypesField = "accepted_gift_types" +const val ownedGiftIdField = "owned_gift_id" +const val convertStarCountField = "convert_star_count" +const val prepaidUpgradeStarCountField = "prepaid_upgrade_star_count" +const val canBeUpgradedField = "can_be_upgraded" +const val isPrivateField = "is_private" const val pointField = "point" const val xShiftField = "x_shift" diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/gifts/GiftInfo.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/gifts/GiftInfo.kt new file mode 100644 index 0000000000..d85df96526 --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/gifts/GiftInfo.kt @@ -0,0 +1,26 @@ +package dev.inmo.tgbotapi.types.gifts + +import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.message.RawMessageEntities +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class GiftInfo private constructor( + @SerialName(giftField) + val gift: Gift, + @SerialName(ownedGiftIdField) + val ownedGiftId: GiftId? = null, + @SerialName(convertStarCountField) + val convertStarCount: Int? = null, + @SerialName(prepaidUpgradeStarCountField) + val prepaidUpgradeStarCount: Int? = null, + @SerialName(canBeUpgradedField) + val canBeUpgraded: Boolean = false, + @SerialName(textField) + val text: String? = null, + @SerialName(entitiesField) + val entities: RawMessageEntities, + @SerialName(isPrivateField) + val isPrivate: Boolean = false +) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/RawMessage.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/RawMessage.kt index 2fa2995bc8..ec99fdcb25 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/RawMessage.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/RawMessage.kt @@ -10,6 +10,7 @@ import dev.inmo.tgbotapi.types.dice.Dice import dev.inmo.tgbotapi.types.files.* import dev.inmo.tgbotapi.types.files.Sticker import dev.inmo.tgbotapi.types.games.RawGame +import dev.inmo.tgbotapi.types.gifts.GiftInfo import dev.inmo.tgbotapi.types.giveaway.* import dev.inmo.tgbotapi.types.message.content.GiveawayContent import dev.inmo.tgbotapi.types.location.Location @@ -160,6 +161,9 @@ internal data class RawMessage( private val giveaway: Giveaway? = null, private val giveaway_winners: GiveawayPublicResults? = null, private val giveaway_completed: GiveawayPrivateResults? = null, + + // Gifts + private val gift: GiftInfo? = null ) { private val checkedFrom = from ?.takeIf { !it.isFakeTelegramUser() } private val content: MessageContent? by lazy {