1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-25 19:48:43 +00:00

InlineKeyboardButton now is an interface

This commit is contained in:
InsanusMokrassar 2021-05-29 13:40:48 +06:00
parent e90e25ab01
commit 12184cd2be

View File

@ -7,22 +7,22 @@ import kotlinx.serialization.Serializable
import kotlinx.serialization.json.JsonElement import kotlinx.serialization.json.JsonElement
@Serializable(InlineKeyboardButtonSerializer::class) @Serializable(InlineKeyboardButtonSerializer::class)
sealed class InlineKeyboardButton { sealed interface InlineKeyboardButton {
abstract val text: String val text: String
} }
@Serializable @Serializable
data class UnknownInlineKeyboardButton internal constructor( data class UnknownInlineKeyboardButton internal constructor(
override val text: String, override val text: String,
val rawData: JsonElement val rawData: JsonElement
) : InlineKeyboardButton() ) : InlineKeyboardButton
@Serializable @Serializable
data class PayInlineKeyboardButton( data class PayInlineKeyboardButton(
override val text: String, override val text: String,
@SerialName(payField) @SerialName(payField)
val pay: Boolean val pay: Boolean
) : InlineKeyboardButton() ) : InlineKeyboardButton
@Serializable @Serializable
data class CallbackDataInlineKeyboardButton( data class CallbackDataInlineKeyboardButton(
@ -30,13 +30,13 @@ data class CallbackDataInlineKeyboardButton(
override val text: String, override val text: String,
@SerialName(callbackDataField) @SerialName(callbackDataField)
val callbackData: String val callbackData: String
) : InlineKeyboardButton() ) : InlineKeyboardButton
@Serializable @Serializable
data class CallbackGameInlineKeyboardButton( data class CallbackGameInlineKeyboardButton(
@SerialName(textField) @SerialName(textField)
override val text: String override val text: String
) : InlineKeyboardButton() { ) : InlineKeyboardButton {
@SerialName(callbackGameField) @SerialName(callbackGameField)
private val callbackGame = CallbackGame private val callbackGame = CallbackGame
} }
@ -46,25 +46,25 @@ data class LoginURLInlineKeyboardButton(
override val text: String, override val text: String,
@SerialName(loginUrlField) @SerialName(loginUrlField)
val loginUrl: LoginURL val loginUrl: LoginURL
) : InlineKeyboardButton() ) : InlineKeyboardButton
@Serializable @Serializable
data class SwitchInlineQueryCurrentChatInlineKeyboardButton( data class SwitchInlineQueryCurrentChatInlineKeyboardButton(
override val text: String, override val text: String,
@SerialName(switchInlineQueryCurrentChatField) @SerialName(switchInlineQueryCurrentChatField)
val switchInlineQueryCurrentChat: String val switchInlineQueryCurrentChat: String
) : InlineKeyboardButton() ) : InlineKeyboardButton
@Serializable @Serializable
data class SwitchInlineQueryInlineKeyboardButton( data class SwitchInlineQueryInlineKeyboardButton(
override val text: String, override val text: String,
@SerialName(switchInlineQueryField) @SerialName(switchInlineQueryField)
val switchInlineQuery: String val switchInlineQuery: String
) : InlineKeyboardButton() ) : InlineKeyboardButton
@Serializable @Serializable
data class URLInlineKeyboardButton( data class URLInlineKeyboardButton(
override val text: String, override val text: String,
@SerialName(urlField) @SerialName(urlField)
val url: String val url: String
) : InlineKeyboardButton() ) : InlineKeyboardButton