mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
add support of input_field_placeholder
This commit is contained in:
parent
7f69052dea
commit
656bb68739
@ -82,6 +82,8 @@ val membersLimit = 1 .. 99999
|
||||
|
||||
val suggestedTipAmountsLimit = 1 .. 4
|
||||
|
||||
val inputFieldPlaceholderLimit = 1 .. 64
|
||||
|
||||
const val botActionActualityTime: Seconds = 5
|
||||
|
||||
// Made as lazy for correct work in K/JS
|
||||
@ -366,6 +368,8 @@ const val requireShippingAddressField = "need_shipping_address"
|
||||
const val shouldSendPhoneNumberToProviderField = "send_phone_number_to_provider"
|
||||
const val shouldSendEmailToProviderField = "send_email_to_provider"
|
||||
|
||||
const val inputFieldPlaceholderField = "input_field_placeholder"
|
||||
|
||||
const val priceDependOnShipAddressField = "is_flexible"
|
||||
|
||||
const val documentField = "document"
|
||||
|
@ -1,10 +1,14 @@
|
||||
package dev.inmo.tgbotapi.types.buttons
|
||||
|
||||
import dev.inmo.tgbotapi.types.inputFieldPlaceholderField
|
||||
import dev.inmo.tgbotapi.types.inputFieldPlaceholderLimit
|
||||
import kotlinx.serialization.*
|
||||
|
||||
@Serializable
|
||||
data class ReplyForce(
|
||||
val selective: Boolean? = null
|
||||
val selective: Boolean? = null,
|
||||
@SerialName(inputFieldPlaceholderField)
|
||||
val inputFieldPlaceholder: String? = null
|
||||
) : KeyboardMarkup {
|
||||
@SerialName("force_reply")
|
||||
@Required
|
||||
@ -15,6 +19,12 @@ data class ReplyForce(
|
||||
val ReplyForceNonSelective = ReplyForce(false)
|
||||
val ReplyForceDefault = ReplyForce()
|
||||
}
|
||||
|
||||
init {
|
||||
if (inputFieldPlaceholder != null && inputFieldPlaceholder.length !in inputFieldPlaceholderLimit) {
|
||||
error("Field $inputFieldPlaceholderField length must be in $inputFieldPlaceholderLimit, but was ${inputFieldPlaceholder.length}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Renamed", ReplaceWith("ReplyForce", "dev.inmo.tgbotapi.types.buttons.ReplyForce"))
|
||||
|
@ -1,5 +1,7 @@
|
||||
package dev.inmo.tgbotapi.types.buttons
|
||||
|
||||
import dev.inmo.tgbotapi.types.inputFieldPlaceholderField
|
||||
import dev.inmo.tgbotapi.types.inputFieldPlaceholderLimit
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@ -10,5 +12,13 @@ data class ReplyKeyboardMarkup(
|
||||
val resizeKeyboard: Boolean? = null,
|
||||
@SerialName("one_time_keyboard")
|
||||
val oneTimeKeyboard: Boolean? = null,
|
||||
@SerialName(inputFieldPlaceholderField)
|
||||
val inputFieldPlaceholder: String? = null,
|
||||
val selective: Boolean? = null
|
||||
) : KeyboardMarkup
|
||||
) : KeyboardMarkup {
|
||||
init {
|
||||
if (inputFieldPlaceholder != null && inputFieldPlaceholder.length !in inputFieldPlaceholderLimit) {
|
||||
error("Field $inputFieldPlaceholderField length must be in $inputFieldPlaceholderLimit, but was ${inputFieldPlaceholder.length}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,10 +8,12 @@ fun ReplyKeyboardMarkup(
|
||||
vararg buttons: KeyboardButton,
|
||||
resizeKeyboard: Boolean? = null,
|
||||
oneTimeKeyboard: Boolean? = null,
|
||||
inputFieldPlaceholder: String? = null,
|
||||
selective: Boolean? = null
|
||||
): ReplyKeyboardMarkup = ReplyKeyboardMarkup(
|
||||
flatMatrix { buttons.forEach { +it } },
|
||||
resizeKeyboard,
|
||||
oneTimeKeyboard,
|
||||
inputFieldPlaceholder,
|
||||
selective
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user