From 983e5edf7b08777f87b276f68eca3a179357be55 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 7 Feb 2019 20:19:25 +0800 Subject: [PATCH] inline messages edit result fixes --- CHANGELOG.md | 1 + .../edit/LiveLocation/EditChatMessageLiveLocation.kt | 1 - .../edit/LiveLocation/EditInlineMessageLiveLocation.kt | 3 +-- .../edit/LiveLocation/StopChatMessageLiveLocation.kt | 1 - .../edit/LiveLocation/StopInlineMessageLiveLocation.kt | 2 -- .../edit/ReplyMarkup/EditInlineMessageReplyMarkup.kt | 2 -- .../requests/edit/abstracts/EditInlineMessage.kt | 5 ++++- .../requests/edit/abstracts/EditTextChatMessage.kt | 4 +--- .../requests/edit/caption/EditInlineMessageCaption.kt | 2 -- .../requests/edit/media/EditInlineMessageMedia.kt | 3 +-- .../requests/edit/text/EditInlineMessageText.kt | 2 -- 11 files changed, 8 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24bd4724a4..c9cc4f49bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * Added `InputMessageContent` * Update some types and requests according to abstractions replacing * Add all `InlineQueryResult`, `InputMessageContent` and other inline mode types +* Fixes in edition of inline messages and their result types ## 0.9.0 diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/EditChatMessageLiveLocation.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/EditChatMessageLiveLocation.kt index 1fdbce0748..6e274db55f 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/EditChatMessageLiveLocation.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/EditChatMessageLiveLocation.kt @@ -6,7 +6,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMa import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage import kotlinx.serialization.* -// TODO:: Replace return type by RawMessage or Boolean (as in documentation) @Serializable data class EditChatMessageLiveLocation( @SerialName(chatIdField) diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/EditInlineMessageLiveLocation.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/EditInlineMessageLiveLocation.kt index 83d032ba86..5ade3ffb97 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/EditInlineMessageLiveLocation.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/EditInlineMessageLiveLocation.kt @@ -5,8 +5,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage import kotlinx.serialization.* +import kotlinx.serialization.internal.BooleanSerializer -// TODO:: Replace return type by RawMessage or Boolean (as in documentation) @Serializable data class EditInlineMessageLiveLocation( @SerialName(inlineMessageIdField) @@ -20,5 +20,4 @@ data class EditInlineMessageLiveLocation( override val replyMarkup: InlineKeyboardMarkup? = null ) : EditInlineMessage, EditReplyMessage, EditLocationMessage { override fun method(): String = "editMessageLiveLocation" - override fun resultSerializer(): KSerializer = RawMessage.serializer() } diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/StopChatMessageLiveLocation.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/StopChatMessageLiveLocation.kt index 16693cf6ce..aa9fae5b02 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/StopChatMessageLiveLocation.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/StopChatMessageLiveLocation.kt @@ -7,7 +7,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMa import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage import kotlinx.serialization.* -// TODO:: Replace return type by RawMessage or Boolean (as in documentation) @Serializable data class StopChatMessageLiveLocation( @SerialName(chatIdField) diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/StopInlineMessageLiveLocation.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/StopInlineMessageLiveLocation.kt index ccbd01aa37..d696d0be2d 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/StopInlineMessageLiveLocation.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/StopInlineMessageLiveLocation.kt @@ -7,7 +7,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMa import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage import kotlinx.serialization.* -// TODO:: Replace return type by RawMessage or Boolean (as in documentation) @Serializable data class StopInlineMessageLiveLocation( @SerialName(inlineMessageIdField) @@ -17,5 +16,4 @@ data class StopInlineMessageLiveLocation( override val replyMarkup: InlineKeyboardMarkup? = null ) : EditInlineMessage, EditReplyMessage { override fun method(): String = "stopMessageLiveLocation" - override fun resultSerializer(): KSerializer = RawMessage.serializer() } diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/ReplyMarkup/EditInlineMessageReplyMarkup.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/ReplyMarkup/EditInlineMessageReplyMarkup.kt index 38ad293c5f..6739d5cc6d 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/ReplyMarkup/EditInlineMessageReplyMarkup.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/ReplyMarkup/EditInlineMessageReplyMarkup.kt @@ -15,7 +15,5 @@ data class EditInlineMessageReplyMarkup( @Optional override val replyMarkup: InlineKeyboardMarkup? = null ) : EditInlineMessage, EditReplyMessage { - override fun method(): String = editMessageReplyMarkupMethod - override fun resultSerializer(): KSerializer = RawMessage.serializer() } diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditInlineMessage.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditInlineMessage.kt index 5f57497583..7b9c44732b 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditInlineMessage.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditInlineMessage.kt @@ -3,7 +3,10 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.types.InlineMessageIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage +import kotlinx.serialization.KSerializer +import kotlinx.serialization.internal.BooleanSerializer -interface EditInlineMessage : SimpleRequest { +interface EditInlineMessage : SimpleRequest { val inlineMessageId: InlineMessageIdentifier + override fun resultSerializer(): KSerializer = BooleanSerializer } \ No newline at end of file diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditTextChatMessage.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditTextChatMessage.kt index 9f87a729c1..028f5694a6 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditTextChatMessage.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditTextChatMessage.kt @@ -1,10 +1,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts -import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode -import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage -interface EditTextChatMessage : SimpleRequest { +interface EditTextChatMessage { val text: String val parseMode: ParseMode? } \ No newline at end of file diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/caption/EditInlineMessageCaption.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/caption/EditInlineMessageCaption.kt index d4a6a07030..5c021d7492 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/caption/EditInlineMessageCaption.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/caption/EditInlineMessageCaption.kt @@ -21,7 +21,5 @@ data class EditInlineMessageCaption( @Optional override val replyMarkup: InlineKeyboardMarkup? = null ) : EditInlineMessage, EditTextChatMessage, EditReplyMessage { - override fun method(): String = editMessageCaptionMethod - override fun resultSerializer(): KSerializer = RawMessage.serializer() } diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/media/EditInlineMessageMedia.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/media/EditInlineMessageMedia.kt index 828941bee8..c55e3f9dae 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/media/EditInlineMessageMedia.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/media/EditInlineMessageMedia.kt @@ -1,4 +1,4 @@ -package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.text +package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.media import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.* @@ -27,5 +27,4 @@ data class EditInlineMessageMedia( } override fun method(): String = editMessageMediaMethod - override fun resultSerializer(): KSerializer = RawMessage.serializer() } diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/text/EditInlineMessageText.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/text/EditInlineMessageText.kt index bb853c2704..a130e46c4a 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/text/EditInlineMessageText.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/text/EditInlineMessageText.kt @@ -25,7 +25,5 @@ data class EditInlineMessageText( @Optional override val replyMarkup: InlineKeyboardMarkup? = null ) : EditInlineMessage, EditTextChatMessage, EditReplyMessage, EditDisableWebPagePreviewMessage { - override fun method(): String = editMessageMediaMethod - override fun resultSerializer(): KSerializer = RawMessage.serializer() }