1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 08:13:47 +00:00

update order of fields in RawUpdate

This commit is contained in:
InsanusMokrassar 2019-05-16 15:13:13 +08:00
parent 84a086e7e4
commit 3ea96fc61f

View File

@ -18,10 +18,10 @@ import kotlinx.serialization.*
data class RawUpdate constructor( data class RawUpdate constructor(
@SerialName(updateIdField) @SerialName(updateIdField)
val updateId: UpdateIdentifier, val updateId: UpdateIdentifier,
private val message: RawMessage? = null,
private val edited_message: RawMessage? = null, private val edited_message: RawMessage? = null,
private val channel_post: RawMessage? = null, private val message: RawMessage? = null,
private val edited_channel_post: RawMessage? = null, private val edited_channel_post: RawMessage? = null,
private val channel_post: RawMessage? = null,
private val inline_query: RawInlineQuery? = null, private val inline_query: RawInlineQuery? = null,
private val chosen_inline_result: RawChosenInlineResult? = null, private val chosen_inline_result: RawChosenInlineResult? = null,
private val callback_query: RawCallbackQuery? = null, private val callback_query: RawCallbackQuery? = null,
@ -32,10 +32,10 @@ data class RawUpdate constructor(
@Transient @Transient
val asUpdate: Update by lazy { val asUpdate: Update by lazy {
when { when {
message != null -> MessageUpdate(updateId, message.asMessage)
edited_message != null -> EditMessageUpdate(updateId, edited_message.asMessage) edited_message != null -> EditMessageUpdate(updateId, edited_message.asMessage)
channel_post != null -> ChannelPostUpdate(updateId, channel_post.asMessage) message != null -> MessageUpdate(updateId, message.asMessage)
edited_channel_post != null -> EditChannelPostUpdate(updateId, edited_channel_post.asMessage) edited_channel_post != null -> EditChannelPostUpdate(updateId, edited_channel_post.asMessage)
channel_post != null -> ChannelPostUpdate(updateId, channel_post.asMessage)
chosen_inline_result != null -> ChosenInlineResultUpdate(updateId, chosen_inline_result.asChosenInlineResult) chosen_inline_result != null -> ChosenInlineResultUpdate(updateId, chosen_inline_result.asChosenInlineResult)
inline_query != null -> InlineQueryUpdate(updateId, inline_query.asInlineQuery) inline_query != null -> InlineQueryUpdate(updateId, inline_query.asInlineQuery)