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