1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2026-03-03 17:32:23 +00:00
This commit is contained in:
2026-02-15 13:53:41 +06:00
parent cea80ccee6
commit 44ce84cb84
10 changed files with 693 additions and 141 deletions

View File

@@ -8,7 +8,6 @@ import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.excludeUnsavedField
import dev.inmo.tgbotapi.types.excludeSavedField
import dev.inmo.tgbotapi.types.excludeUnlimitedField
import dev.inmo.tgbotapi.types.excludeLimitedField
import dev.inmo.tgbotapi.types.excludeLimitedUpgradableField
import dev.inmo.tgbotapi.types.excludeLimitedNonUpgradableField
import dev.inmo.tgbotapi.types.excludeUniqueField
@@ -32,9 +31,6 @@ data class GetBusinessAccountGifts(
val excludeSaved: Boolean = false,
@SerialName(excludeUnlimitedField)
val excludeUnlimited: Boolean = false,
@Deprecated("Use excludeLimitedUpgradable and excludeLimitedNonUpgradable instead")
@SerialName(excludeLimitedField)
val excludeLimited: Boolean = false,
@SerialName(excludeLimitedUpgradableField)
val excludeLimitedUpgradable: Boolean = false,
@SerialName(excludeLimitedNonUpgradableField)

View File

@@ -656,6 +656,7 @@ const val mediaField = "media"
const val mainFrameTimestampField = "main_frame_timestamp"
const val paidMessageStarCountField = "paid_message_star_count"
const val countField = "count"
const val ratingField = "rating"
const val uniqueGiftColorsField = "unique_gift_colors"
const val paidStarCountField = "paid_star_count"
@@ -755,6 +756,12 @@ const val textColorField = "text_color"
const val nameColorField = "name_color"
const val baseColorField = "base_color"
const val linkColorField = "link_color"
const val modelCustomEmojiIdField = "model_custom_emoji_id"
const val symbolCustomEmojiIdField = "symbol_custom_emoji_id"
const val lightThemeMainColorField = "light_theme_main_color"
const val lightThemeOtherColorsField = "light_theme_other_colors"
const val darkThemeMainColorField = "dark_theme_main_color"
const val darkThemeOtherColorsField = "dark_theme_other_colors"
const val baseNameField = "base_name"
const val numberField = "number"

View File

@@ -16,10 +16,11 @@ import kotlinx.serialization.encoding.Encoder
@Serializable(Gift.Companion::class)
sealed interface Gift {
val id: GiftId?
val publisherChat: PreviewChat?
@Serializable(Regular.Companion::class)
sealed interface Regular : Gift {
val id: GiftId
override val id: GiftId
val sticker: Sticker
val starCount: Int
val totalCount: Int?
@@ -175,7 +176,7 @@ sealed interface Gift {
@Serializable
data class Unique(
@SerialName(giftIdField)
val id: GiftId? = null,
override val id: GiftId? = null,
@SerialName(baseNameField)
val baseName: String,
@SerialName(nameField)
@@ -195,7 +196,7 @@ sealed interface Gift {
@SerialName(isPremiumField2)
val isPremium: Boolean = false,
@SerialName(colorsField)
val colors: UniqueGiftColors = null
val colors: UniqueGiftColors? = null
) : Gift
companion object : KSerializer<Gift> {
@@ -257,7 +258,7 @@ sealed interface Gift {
value: Gift
) {
val surrogate = GiftSurrogate(
id = (value as? Regular)?.id,
id = value.id,
sticker = (value as? Regular)?.sticker,
star_count = (value as? Regular)?.starCount,
total_count = (value as? Regular.Limited)?.totalCount,
@@ -275,7 +276,6 @@ sealed interface Gift {
model = (value as? Unique)?.model,
symbol = (value as? Unique)?.symbol,
backdrop = (value as? Unique)?.backdrop,
gift_id = (value as? Unique)?.id,
is_from_blockchain = (value as? Unique)?.isFromBlockchain ?: false,
colors = (value as? Unique)?.colors,
publisher_chat = value.publisherChat,

View File

@@ -1,13 +1,19 @@
package dev.inmo.tgbotapi.types.gifts
import dev.inmo.tgbotapi.types.backgroundField
import dev.inmo.tgbotapi.types.files.PathedFile
import dev.inmo.tgbotapi.types.centerColorField
import dev.inmo.tgbotapi.types.edgeColorField
import dev.inmo.tgbotapi.types.textColorField
import dev.inmo.tgbotapi.utils.RGBColor
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class GiftBackground(
@SerialName(backgroundField)
val background: PathedFile
@SerialName(centerColorField)
val centerColor: RGBColor,
@SerialName(edgeColorField)
val edgeColor: RGBColor,
@SerialName(textColorField)
val textColor: RGBColor
)

View File

@@ -1,8 +1,6 @@
package dev.inmo.tgbotapi.types.gifts.unique
import dev.inmo.tgbotapi.types.baseColorField
import dev.inmo.tgbotapi.types.linkColorField
import dev.inmo.tgbotapi.types.nameColorField
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.utils.RGBColor
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@@ -10,10 +8,16 @@ import kotlinx.serialization.Serializable
@Serializable
data class UniqueGiftColors(
@SerialName(nameColorField)
val nameColor: RGBColor,
@SerialName(baseColorField)
val baseColor: RGBColor,
@SerialName(linkColorField)
val linkColor: RGBColor
@SerialName(modelCustomEmojiIdField)
val modelCustomEmojiId: CustomEmojiId,
@SerialName(symbolCustomEmojiIdField)
val symbolCustomEmojiId: CustomEmojiId,
@SerialName(lightThemeMainColorField)
val lightThemeMainColor: RGBColor,
@SerialName(lightThemeOtherColorsField)
val lightThemeOtherColors: List<RGBColor>,
@SerialName(darkThemeMainColorField)
val darkThemeMainColor: RGBColor,
@SerialName(darkThemeOtherColorsField)
val darkThemeOtherColors: List<RGBColor>
)