getChat updates completing

This commit is contained in:
InsanusMokrassar 2020-11-04 23:10:39 +06:00
parent fd1a15cb5d
commit 7a2ecd2dbf
8 changed files with 42 additions and 5 deletions

View File

@ -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

View File

@ -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<Boolean> {
override fun method(): String = "unbanChatMember"
override val resultDeserializer: DeserializationStrategy<Boolean>

View File

@ -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
)

View File

@ -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"

View File

@ -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?
}

View File

@ -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?
}

View File

@ -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

View File

@ -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