From b002f61b7182d67fff95f46dcb9d6699c22a91ed Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 20 Apr 2019 13:09:47 +0800 Subject: [PATCH] add serializer to InlineKeyboardButton and remove exact serializer for InlineKeyboardMarkup#keyboard --- .../buttons/InlineKeyboardButtons/InlineKeyboardButton.kt | 7 ++++++- .../TelegramBotAPI/types/buttons/InlineKeyboardMarkup.kt | 5 ----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardButtons/InlineKeyboardButton.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardButtons/InlineKeyboardButton.kt index cf1bfc63b2..35741de405 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardButtons/InlineKeyboardButton.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardButtons/InlineKeyboardButton.kt @@ -1,5 +1,10 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardButtons +import kotlinx.serialization.* + +@Serializable(InlineKeyboardButtonSerializer::class) interface InlineKeyboardButton { val text: String -} \ No newline at end of file +} + +object InlineKeyboardButtonSerializer : KSerializer by ContextSerializer(InlineKeyboardButton::class) diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardMarkup.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardMarkup.kt index 39c5bea691..1e3185ccd5 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardMarkup.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardMarkup.kt @@ -7,10 +7,5 @@ import kotlinx.serialization.internal.ArrayListSerializer @Serializable data class InlineKeyboardMarkup( @SerialName("inline_keyboard") - @Serializable(with = KeyboardSerializer::class) val keyboard: Matrix ) : KeyboardMarkup - -object KeyboardSerializer : KSerializer> by ArrayListSerializer( - ArrayListSerializer(ContextSerializer(InlineKeyboardButton::class)) -)