mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 16:23:48 +00:00
Merge pull request #80 from Djaler/inline-keyboard-button-callback-game
Add support for inline keyboard buttons with callback_game field
This commit is contained in:
commit
55b8736d50
@ -82,6 +82,7 @@ const val containsMasksField = "contains_masks"
|
|||||||
const val resultIdField = "result_id"
|
const val resultIdField = "result_id"
|
||||||
const val inlineMessageIdField = "inline_message_id"
|
const val inlineMessageIdField = "inline_message_id"
|
||||||
const val callbackDataField = "callback_data"
|
const val callbackDataField = "callback_data"
|
||||||
|
const val callbackGameField = "callback_game"
|
||||||
const val callbackQueryIdField = "callback_query_id"
|
const val callbackQueryIdField = "callback_query_id"
|
||||||
const val inlineQueryIdField = "inline_query_id"
|
const val inlineQueryIdField = "inline_query_id"
|
||||||
const val inlineKeyboardField = "inline_keyboard"
|
const val inlineKeyboardField = "inline_keyboard"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardButtons
|
package com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardButtons
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.games.CallbackGame
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@ -24,6 +25,14 @@ data class CallbackDataInlineKeyboardButton(
|
|||||||
val callbackData: String
|
val callbackData: String
|
||||||
) : InlineKeyboardButton()
|
) : InlineKeyboardButton()
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class CallbackGameInlineKeyboardButton(
|
||||||
|
@SerialName(textField)
|
||||||
|
override val text: String,
|
||||||
|
@SerialName(callbackGameField)
|
||||||
|
val callbackGame: CallbackGame
|
||||||
|
) : InlineKeyboardButton()
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class LoginURLInlineKeyboardButton(
|
data class LoginURLInlineKeyboardButton(
|
||||||
override val text: String,
|
override val text: String,
|
||||||
|
@ -15,6 +15,7 @@ internal object InlineKeyboardButtonSerializer : KSerializer<InlineKeyboardButto
|
|||||||
private fun resolveSerializer(json: JsonObject): KSerializer<out InlineKeyboardButton> {
|
private fun resolveSerializer(json: JsonObject): KSerializer<out InlineKeyboardButton> {
|
||||||
return when {
|
return when {
|
||||||
json[callbackDataField] != null -> CallbackDataInlineKeyboardButton.serializer()
|
json[callbackDataField] != null -> CallbackDataInlineKeyboardButton.serializer()
|
||||||
|
json[callbackGameField] != null -> CallbackGameInlineKeyboardButton.serializer()
|
||||||
json[loginUrlField] != null -> LoginURLInlineKeyboardButton.serializer()
|
json[loginUrlField] != null -> LoginURLInlineKeyboardButton.serializer()
|
||||||
json[payField] != null -> PayInlineKeyboardButton.serializer()
|
json[payField] != null -> PayInlineKeyboardButton.serializer()
|
||||||
json[switchInlineQueryField] != null -> SwitchInlineQueryInlineKeyboardButton.serializer()
|
json[switchInlineQueryField] != null -> SwitchInlineQueryInlineKeyboardButton.serializer()
|
||||||
|
Loading…
Reference in New Issue
Block a user