diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d81011c81..bf21e246f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,10 @@ * New field `dropPendingUpdates`. It works the same as `drop_pending_updates` in [setWebhook](https://core.telegram.org/bots/api#setwebhook) section * New field `ExtendedPrivateChat#bio` + * New data class `ChatLocation` + * New field `UnbanChatMember#onlyIfBanned` + * New fields `ExtendedChannelChat#linkedGroupChatId` and `ExtendedSupergroupChat#linkedChannelChatId` + * New fields `ExtendedSupergroupChat#location` ## 0.29.4 diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/UnbanChatMember.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/UnbanChatMember.kt index 6aef8178e3..afe519c847 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/UnbanChatMember.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/chat/members/UnbanChatMember.kt @@ -10,7 +10,9 @@ data class UnbanChatMember( @SerialName(chatIdField) override val chatId: ChatIdentifier, @SerialName(userIdField) - override val userId: UserId + override val userId: UserId, + @SerialName(onlyIfBannedField) + val onlyIfBanned: Boolean? = null ) : ChatMemberRequest { override fun method(): String = "unbanChatMember" override val resultDeserializer: DeserializationStrategy diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatLocation.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatLocation.kt new file mode 100644 index 0000000000..76c6558d0a --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatLocation.kt @@ -0,0 +1,18 @@ +package dev.inmo.tgbotapi.types + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +/** + * Represents a location to which a chat is connected. + * + * @see dev.inmo.tgbotapi.requests.chat.get.GetChat + * @see dev.inmo.tgbotapi.types.chat.abstracts.extended.ExtendedSupergroupChat + */ +@Serializable +data class ChatLocation( + @SerialName(locationField) + val location: Location, + @SerialName(addressField) + val address: String +) 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 1452412f73..3957c733d5 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 @@ -102,6 +102,7 @@ const val slowModeDelayField = "slow_mode_delay" const val maskPositionField = "mask_position" const val phoneNumberField = "phone_number" const val userIdField = "user_id" +const val onlyIfBannedField = "only_if_banned" const val containsMasksField = "contains_masks" const val resultIdField = "result_id" const val inlineMessageIdField = "inline_message_id" @@ -145,6 +146,7 @@ const val pinnedMessageField = "pinned_message" const val customTitleField = "custom_title" const val optionIdsField = "option_ids" const val ipAddressField = "ip_address" +const val linkedChatIdField = "linked_chat_id" const val requestContactField = "request_contact" const val requestLocationField = "request_location" diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/extended/ExtendedChannelChat.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/extended/ExtendedChannelChat.kt index 424e9cd9d7..cbda4c68db 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/extended/ExtendedChannelChat.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/extended/ExtendedChannelChat.kt @@ -1,5 +1,8 @@ package dev.inmo.tgbotapi.types.chat.abstracts.extended +import dev.inmo.tgbotapi.types.ChatId import dev.inmo.tgbotapi.types.chat.abstracts.ChannelChat -interface ExtendedChannelChat : ChannelChat, ExtendedPublicChat +interface ExtendedChannelChat : ChannelChat, ExtendedPublicChat { + val linkedGroupChatId: ChatId? +} diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/extended/ExtendedSupergroupChat.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/extended/ExtendedSupergroupChat.kt index f850ac7601..75ef3df3f6 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/extended/ExtendedSupergroupChat.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/abstracts/extended/ExtendedSupergroupChat.kt @@ -1,10 +1,12 @@ package dev.inmo.tgbotapi.types.chat.abstracts.extended -import dev.inmo.tgbotapi.types.StickerSetName +import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.chat.abstracts.SupergroupChat interface ExtendedSupergroupChat : SupergroupChat, ExtendedGroupChat { val slowModeDelay: Long? val stickerSetName: StickerSetName? val canSetStickerSet: Boolean + val linkedChannelChatId: ChatId? + val location: ChatLocation? } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/extended/ExtendedChannelChatImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/extended/ExtendedChannelChatImpl.kt index f7a050628b..d632a1f04d 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/extended/ExtendedChannelChatImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/extended/ExtendedChannelChatImpl.kt @@ -23,5 +23,7 @@ data class ExtendedChannelChatImpl( override val inviteLink: String? = null, @SerialName(pinnedMessageField) @Serializable(TelegramBotAPIMessageDeserializeOnlySerializer::class) - override val pinnedMessage: Message? = null + override val pinnedMessage: Message? = null, + @SerialName(linkedChatIdField) + override val linkedGroupChatId: ChatId? = null ) : ExtendedChannelChat diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/extended/ExtendedSupergroupChatImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/extended/ExtendedSupergroupChatImpl.kt index 1e10877159..df17d30760 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/extended/ExtendedSupergroupChatImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/extended/ExtendedSupergroupChatImpl.kt @@ -32,5 +32,9 @@ data class ExtendedSupergroupChatImpl( @SerialName(slowModeDelayField) override val slowModeDelay: Long? = null, @SerialName(canSetStickerSetField) - override val canSetStickerSet: Boolean = false + override val canSetStickerSet: Boolean = false, + @SerialName(linkedChatIdField) + override val linkedChannelChatId: ChatId? = null, + @SerialName(locationField) + override val location: ChatLocation? = null ) : ExtendedSupergroupChat