mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
add support of premium fields
This commit is contained in:
parent
f2e9bf6bd8
commit
04db76831f
@ -3,6 +3,7 @@
|
|||||||
## 2.1.0
|
## 2.1.0
|
||||||
|
|
||||||
* Add support of functionality for `WebApp`s from [Bot API 6.1](https://core.telegram.org/bots/api-changelog#june-20-2022)
|
* Add support of functionality for `WebApp`s from [Bot API 6.1](https://core.telegram.org/bots/api-changelog#june-20-2022)
|
||||||
|
* Add support of functionality for premium feature from [Bot API 6.1](https://core.telegram.org/bots/api-changelog#june-20-2022)
|
||||||
|
|
||||||
## 2.0.3
|
## 2.0.3
|
||||||
|
|
||||||
|
@ -117,6 +117,7 @@ const val isBotField = "is_bot"
|
|||||||
const val firstNameField = "first_name"
|
const val firstNameField = "first_name"
|
||||||
const val lastNameField = "last_name"
|
const val lastNameField = "last_name"
|
||||||
const val languageCodeField = "language_code"
|
const val languageCodeField = "language_code"
|
||||||
|
const val isPremiumField = "is_premium"
|
||||||
const val hasPrivateForwardsField = "has_private_forwards"
|
const val hasPrivateForwardsField = "has_private_forwards"
|
||||||
const val canJoinGroupsField = "can_join_groups"
|
const val canJoinGroupsField = "can_join_groups"
|
||||||
const val canReadAllGroupMessagesField = "can_read_all_group_messages"
|
const val canReadAllGroupMessagesField = "can_read_all_group_messages"
|
||||||
@ -124,6 +125,7 @@ const val supportInlineQueriesField = "supports_inline_queries"
|
|||||||
const val textEntitiesField = "text_entities"
|
const val textEntitiesField = "text_entities"
|
||||||
const val entitiesField = "entities"
|
const val entitiesField = "entities"
|
||||||
const val stickerSetNameField = "set_name"
|
const val stickerSetNameField = "set_name"
|
||||||
|
const val premiumAnimationField = "premium_animation"
|
||||||
const val stickerSetNameFullField = "sticker_set_name"
|
const val stickerSetNameFullField = "sticker_set_name"
|
||||||
const val slowModeDelayField = "slow_mode_delay"
|
const val slowModeDelayField = "slow_mode_delay"
|
||||||
const val maskPositionField = "mask_position"
|
const val maskPositionField = "mask_position"
|
||||||
@ -180,6 +182,8 @@ const val customTitleField = "custom_title"
|
|||||||
const val optionIdsField = "option_ids"
|
const val optionIdsField = "option_ids"
|
||||||
const val ipAddressField = "ip_address"
|
const val ipAddressField = "ip_address"
|
||||||
const val linkedChatIdField = "linked_chat_id"
|
const val linkedChatIdField = "linked_chat_id"
|
||||||
|
const val joinToSendMessagesField = "join_to_send_messages"
|
||||||
|
const val joinByRequestField = "join_by_request"
|
||||||
const val horizontalAccuracyField = "horizontal_accuracy"
|
const val horizontalAccuracyField = "horizontal_accuracy"
|
||||||
const val revokeMessagesField = "revoke_messages"
|
const val revokeMessagesField = "revoke_messages"
|
||||||
const val messageAutoDeleteTimeField = "message_auto_delete_time"
|
const val messageAutoDeleteTimeField = "message_auto_delete_time"
|
||||||
|
@ -32,6 +32,11 @@ sealed interface UsernameChat : Chat {
|
|||||||
val username: Username?
|
val username: Username?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable(PreviewChatSerializer::class)
|
||||||
|
sealed interface PremiumChat : Chat {
|
||||||
|
val isPremium: Boolean
|
||||||
|
}
|
||||||
|
|
||||||
@Serializable(PreviewChatSerializer::class)
|
@Serializable(PreviewChatSerializer::class)
|
||||||
sealed interface Chat {
|
sealed interface Chat {
|
||||||
val id: ChatId
|
val id: ChatId
|
||||||
|
@ -95,7 +95,11 @@ data class ExtendedSupergroupChatImpl(
|
|||||||
@SerialName(linkedChatIdField)
|
@SerialName(linkedChatIdField)
|
||||||
override val linkedChannelChatId: ChatId? = null,
|
override val linkedChannelChatId: ChatId? = null,
|
||||||
@SerialName(locationField)
|
@SerialName(locationField)
|
||||||
override val location: ChatLocation? = null
|
override val location: ChatLocation? = null,
|
||||||
|
@SerialName(joinToSendMessagesField)
|
||||||
|
override val requireToJoinForMessaging: Boolean = false,
|
||||||
|
@SerialName(joinByRequestField)
|
||||||
|
override val requireAdminApproveOnJoin: Boolean = false
|
||||||
) : ExtendedSupergroupChat
|
) : ExtendedSupergroupChat
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
|
@ -39,6 +39,16 @@ sealed interface ExtendedSupergroupChat : SupergroupChat, ExtendedGroupChat {
|
|||||||
val canSetStickerSet: Boolean
|
val canSetStickerSet: Boolean
|
||||||
val linkedChannelChatId: ChatId?
|
val linkedChannelChatId: ChatId?
|
||||||
val location: ChatLocation?
|
val location: ChatLocation?
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This field represents field "join_to_send_messages" from API
|
||||||
|
*/
|
||||||
|
val requireToJoinForMessaging: Boolean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This field represents field "join_by_request" from API
|
||||||
|
*/
|
||||||
|
val requireAdminApproveOnJoin: Boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serializable(ExtendedChatSerializer::class)
|
@Serializable(ExtendedChatSerializer::class)
|
||||||
|
@ -80,8 +80,10 @@ data class CommonUser(
|
|||||||
override val username: Username? = null,
|
override val username: Username? = null,
|
||||||
@SerialName(languageCodeField)
|
@SerialName(languageCodeField)
|
||||||
@Serializable(IetfLanguageCodeSerializer::class)
|
@Serializable(IetfLanguageCodeSerializer::class)
|
||||||
override val ietfLanguageCode: IetfLanguageCode? = null
|
override val ietfLanguageCode: IetfLanguageCode? = null,
|
||||||
) : User(), WithOptionalLanguageCode {
|
@SerialName(isPremiumField)
|
||||||
|
override val isPremium: Boolean = false
|
||||||
|
) : User(), WithOptionalLanguageCode, PremiumChat {
|
||||||
constructor(
|
constructor(
|
||||||
id: UserId,
|
id: UserId,
|
||||||
firstName: String,
|
firstName: String,
|
||||||
|
@ -22,7 +22,8 @@ data class StickerSurrogate(
|
|||||||
val emoji: String? = null,
|
val emoji: String? = null,
|
||||||
val set_name: StickerSetName? = null,
|
val set_name: StickerSetName? = null,
|
||||||
val mask_position: MaskPosition? = null,
|
val mask_position: MaskPosition? = null,
|
||||||
val file_size: Long? = null
|
val file_size: Long? = null,
|
||||||
|
val premium_animation: File? = null
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO:: Serializer
|
// TODO:: Serializer
|
||||||
@ -31,6 +32,7 @@ sealed interface Sticker : TelegramMediaFile, SizedMediaFile, ThumbedMediaFile {
|
|||||||
val emoji: String?
|
val emoji: String?
|
||||||
val maskPosition: MaskPosition?
|
val maskPosition: MaskPosition?
|
||||||
val stickerSetName: StickerSetName?
|
val stickerSetName: StickerSetName?
|
||||||
|
val premiumAnimationFile: File?
|
||||||
|
|
||||||
val isAnimated
|
val isAnimated
|
||||||
get() = this is AnimatedSticker
|
get() = this is AnimatedSticker
|
||||||
@ -53,6 +55,7 @@ object StickerSerializer : KSerializer<Sticker> {
|
|||||||
surrogate.thumb,
|
surrogate.thumb,
|
||||||
surrogate.emoji,
|
surrogate.emoji,
|
||||||
surrogate.set_name,
|
surrogate.set_name,
|
||||||
|
surrogate.premium_animation,
|
||||||
surrogate.mask_position,
|
surrogate.mask_position,
|
||||||
surrogate.file_size
|
surrogate.file_size
|
||||||
)
|
)
|
||||||
@ -64,6 +67,7 @@ object StickerSerializer : KSerializer<Sticker> {
|
|||||||
surrogate.thumb,
|
surrogate.thumb,
|
||||||
surrogate.emoji,
|
surrogate.emoji,
|
||||||
surrogate.set_name,
|
surrogate.set_name,
|
||||||
|
surrogate.premium_animation,
|
||||||
surrogate.mask_position,
|
surrogate.mask_position,
|
||||||
surrogate.file_size
|
surrogate.file_size
|
||||||
)
|
)
|
||||||
@ -75,6 +79,7 @@ object StickerSerializer : KSerializer<Sticker> {
|
|||||||
surrogate.thumb,
|
surrogate.thumb,
|
||||||
surrogate.emoji,
|
surrogate.emoji,
|
||||||
surrogate.set_name,
|
surrogate.set_name,
|
||||||
|
surrogate.premium_animation,
|
||||||
surrogate.mask_position,
|
surrogate.mask_position,
|
||||||
surrogate.file_size
|
surrogate.file_size
|
||||||
)
|
)
|
||||||
@ -103,6 +108,8 @@ data class SimpleSticker(
|
|||||||
override val emoji: String? = null,
|
override val emoji: String? = null,
|
||||||
@SerialName(stickerSetNameField)
|
@SerialName(stickerSetNameField)
|
||||||
override val stickerSetName: StickerSetName? = null,
|
override val stickerSetName: StickerSetName? = null,
|
||||||
|
@SerialName(premiumAnimationField)
|
||||||
|
override val premiumAnimationFile: File?,
|
||||||
@SerialName(maskPositionField)
|
@SerialName(maskPositionField)
|
||||||
override val maskPosition: MaskPosition? = null,
|
override val maskPosition: MaskPosition? = null,
|
||||||
@SerialName(fileSizeField)
|
@SerialName(fileSizeField)
|
||||||
@ -124,6 +131,8 @@ data class AnimatedSticker(
|
|||||||
override val emoji: String? = null,
|
override val emoji: String? = null,
|
||||||
@SerialName(stickerSetNameField)
|
@SerialName(stickerSetNameField)
|
||||||
override val stickerSetName: StickerSetName? = null,
|
override val stickerSetName: StickerSetName? = null,
|
||||||
|
@SerialName(premiumAnimationField)
|
||||||
|
override val premiumAnimationFile: File?,
|
||||||
@SerialName(maskPositionField)
|
@SerialName(maskPositionField)
|
||||||
override val maskPosition: MaskPosition? = null,
|
override val maskPosition: MaskPosition? = null,
|
||||||
@SerialName(fileSizeField)
|
@SerialName(fileSizeField)
|
||||||
@ -145,6 +154,8 @@ data class VideoSticker(
|
|||||||
override val emoji: String? = null,
|
override val emoji: String? = null,
|
||||||
@SerialName(stickerSetNameField)
|
@SerialName(stickerSetNameField)
|
||||||
override val stickerSetName: StickerSetName? = null,
|
override val stickerSetName: StickerSetName? = null,
|
||||||
|
@SerialName(premiumAnimationField)
|
||||||
|
override val premiumAnimationFile: File?,
|
||||||
@SerialName(maskPositionField)
|
@SerialName(maskPositionField)
|
||||||
override val maskPosition: MaskPosition? = null,
|
override val maskPosition: MaskPosition? = null,
|
||||||
@SerialName(fileSizeField)
|
@SerialName(fileSizeField)
|
||||||
|
Loading…
Reference in New Issue
Block a user