mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-09-05 08:09:21 +00:00
feat: implemented GiftInfo class
This commit is contained in:
@@ -493,9 +493,16 @@ const val creatorField = "creator"
|
|||||||
const val subscriptionPeriodField = "subscription_period"
|
const val subscriptionPeriodField = "subscription_period"
|
||||||
const val subscriptionPriceField = "subscription_price"
|
const val subscriptionPriceField = "subscription_price"
|
||||||
const val copyTextField = "copy_text"
|
const val copyTextField = "copy_text"
|
||||||
|
|
||||||
const val giftField = "gift"
|
const val giftField = "gift"
|
||||||
const val giftsField = "gifts"
|
const val giftsField = "gifts"
|
||||||
const val rarityPerMilleField = "rarity_per_mille"
|
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 pointField = "point"
|
||||||
const val xShiftField = "x_shift"
|
const val xShiftField = "x_shift"
|
||||||
|
@@ -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
|
||||||
|
)
|
@@ -10,6 +10,7 @@ import dev.inmo.tgbotapi.types.dice.Dice
|
|||||||
import dev.inmo.tgbotapi.types.files.*
|
import dev.inmo.tgbotapi.types.files.*
|
||||||
import dev.inmo.tgbotapi.types.files.Sticker
|
import dev.inmo.tgbotapi.types.files.Sticker
|
||||||
import dev.inmo.tgbotapi.types.games.RawGame
|
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.giveaway.*
|
||||||
import dev.inmo.tgbotapi.types.message.content.GiveawayContent
|
import dev.inmo.tgbotapi.types.message.content.GiveawayContent
|
||||||
import dev.inmo.tgbotapi.types.location.Location
|
import dev.inmo.tgbotapi.types.location.Location
|
||||||
@@ -160,6 +161,9 @@ internal data class RawMessage(
|
|||||||
private val giveaway: Giveaway? = null,
|
private val giveaway: Giveaway? = null,
|
||||||
private val giveaway_winners: GiveawayPublicResults? = null,
|
private val giveaway_winners: GiveawayPublicResults? = null,
|
||||||
private val giveaway_completed: GiveawayPrivateResults? = null,
|
private val giveaway_completed: GiveawayPrivateResults? = null,
|
||||||
|
|
||||||
|
// Gifts
|
||||||
|
private val gift: GiftInfo? = null
|
||||||
) {
|
) {
|
||||||
private val checkedFrom = from ?.takeIf { !it.isFakeTelegramUser() }
|
private val checkedFrom = from ?.takeIf { !it.isFakeTelegramUser() }
|
||||||
private val content: MessageContent? by lazy {
|
private val content: MessageContent? by lazy {
|
||||||
|
Reference in New Issue
Block a user