1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-12-23 09:07:12 +00:00

add support of users in UsersShared

This commit is contained in:
InsanusMokrassar 2024-04-18 14:47:22 +06:00
parent 6b74bc155e
commit 072264faad

View File

@ -1,6 +1,7 @@
package dev.inmo.tgbotapi.types.request package dev.inmo.tgbotapi.types.request
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.chat.PreviewUser
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
@ -8,15 +9,18 @@ import kotlinx.serialization.Serializable
data class UsersShared( data class UsersShared(
@SerialName(requestIdField) @SerialName(requestIdField)
override val requestId: RequestId, override val requestId: RequestId,
@SerialName(userIdsField) @SerialName(usersField)
val userIds: List<UserId> val users: List<PreviewUser>
) : ChatSharedRequest { ) : ChatSharedRequest {
val userIds: List<UserId> by lazy {
users.map { it.id }
}
val userId: UserId val userId: UserId
get() = userIds.first() get() = userIds.first()
constructor( constructor(
requestId: RequestId, requestId: RequestId,
userId: UserId user: PreviewUser
) : this(requestId, listOf(userId)) ) : this(requestId, listOf(user))
override val chatId: ChatId override val chatId: ChatId
get() = userId get() = userId
} }