mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-26 03:58:44 +00:00
new PassportMessage type
This commit is contained in:
parent
5d87b86afe
commit
a2ae4f71de
@ -0,0 +1,14 @@
|
||||
package dev.inmo.tgbotapi.types.message
|
||||
|
||||
import com.soywiz.klock.DateTime
|
||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.chat.abstracts.Chat
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.passport.PassportData
|
||||
|
||||
data class PassportMessage(
|
||||
override val messageId: MessageIdentifier,
|
||||
override val chat: Chat,
|
||||
override val date: DateTime,
|
||||
val passportData: PassportData
|
||||
) : Message
|
@ -18,6 +18,7 @@ import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
|
||||
import dev.inmo.tgbotapi.types.message.content.media.*
|
||||
import dev.inmo.tgbotapi.types.message.payments.InvoiceContent
|
||||
import dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentInfo
|
||||
import dev.inmo.tgbotapi.types.passport.PassportData
|
||||
import dev.inmo.tgbotapi.types.payments.Invoice
|
||||
import dev.inmo.tgbotapi.types.payments.SuccessfulPayment
|
||||
import dev.inmo.tgbotapi.types.polls.Poll
|
||||
@ -84,7 +85,7 @@ internal data class RawMessage(
|
||||
private val connected_website: String? = null,
|
||||
|
||||
// passport property
|
||||
private val passport_data: Unit? = null,
|
||||
private val passport_data: PassportData? = null,
|
||||
private val proximity_alert_triggered: ProximityAlertTriggered? = null,
|
||||
|
||||
private val reply_markup: InlineKeyboardMarkup? = null
|
||||
@ -324,6 +325,13 @@ internal data class RawMessage(
|
||||
)
|
||||
else -> error("Unknown type of chat: $chat")
|
||||
}
|
||||
} ?: passport_data ?.let{
|
||||
PassportMessage(
|
||||
messageId,
|
||||
chat,
|
||||
date.asDate,
|
||||
passport_data
|
||||
)
|
||||
} ?: error("Was not found supported type of data")
|
||||
} catch (e: Exception) {
|
||||
UnknownMessageType(
|
||||
|
Loading…
Reference in New Issue
Block a user