1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-06-13 13:25:26 +00:00

replace UnknownUpdate

This commit is contained in:
InsanusMokrassar 2020-01-23 03:35:56 +06:00
parent 961fa65415
commit a8ca45a4bd
3 changed files with 10 additions and 10 deletions

View File

@ -9,6 +9,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Telegr
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.PreCheckoutQuery
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.ShippingQuery
import com.github.insanusmokrassar.TelegramBotAPI.types.polls.Poll
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.UnknownUpdate
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update
import com.github.insanusmokrassar.TelegramBotAPI.types.updateIdField
import kotlinx.serialization.SerialName
@ -50,7 +51,10 @@ internal data class RawUpdate constructor(
shipping_query != null -> ShippingQueryUpdate(updateId, shipping_query)
pre_checkout_query != null -> PreCheckoutQueryUpdate(updateId, pre_checkout_query)
poll != null -> PollUpdate(updateId, poll)
else -> UnknownUpdate(updateId, raw)
else -> UnknownUpdate(
updateId,
raw
)
}.also {
initedUpdate = it
}

View File

@ -1,9 +0,0 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.update
import com.github.insanusmokrassar.TelegramBotAPI.types.UpdateIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update
data class UnknownUpdate(
override val updateId: UpdateIdentifier,
override val data: String
) : Update

View File

@ -12,6 +12,11 @@ interface Update {
val data: Any
}
data class UnknownUpdate(
override val updateId: UpdateIdentifier,
override val data: String
) : Update
internal object UpdateSerializerWithoutDeserialization : KSerializer<Update> {
override val descriptor: SerialDescriptor = StringDescriptor.withName("UpdateSerializerWithoutDeserialization")