1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-18 06:13:47 +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
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.chat.PreviewUser
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@ -8,15 +9,18 @@ import kotlinx.serialization.Serializable
data class UsersShared(
@SerialName(requestIdField)
override val requestId: RequestId,
@SerialName(userIdsField)
val userIds: List<UserId>
@SerialName(usersField)
val users: List<PreviewUser>
) : ChatSharedRequest {
val userIds: List<UserId> by lazy {
users.map { it.id }
}
val userId: UserId
get() = userIds.first()
constructor(
requestId: RequestId,
userId: UserId
) : this(requestId, listOf(userId))
user: PreviewUser
) : this(requestId, listOf(user))
override val chatId: ChatId
get() = userId
}