mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-02-16 19:52:01 +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 suggestedTipAmountsLimit = 1 .. 4
|
||||||
|
|
||||||
|
val inputFieldPlaceholderLimit = 1 .. 64
|
||||||
|
|
||||||
const val botActionActualityTime: Seconds = 5
|
const val botActionActualityTime: Seconds = 5
|
||||||
|
|
||||||
// Made as lazy for correct work in K/JS
|
// 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 shouldSendPhoneNumberToProviderField = "send_phone_number_to_provider"
|
||||||
const val shouldSendEmailToProviderField = "send_email_to_provider"
|
const val shouldSendEmailToProviderField = "send_email_to_provider"
|
||||||
|
|
||||||
|
const val inputFieldPlaceholderField = "input_field_placeholder"
|
||||||
|
|
||||||
const val priceDependOnShipAddressField = "is_flexible"
|
const val priceDependOnShipAddressField = "is_flexible"
|
||||||
|
|
||||||
const val documentField = "document"
|
const val documentField = "document"
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
package dev.inmo.tgbotapi.types.buttons
|
package dev.inmo.tgbotapi.types.buttons
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.types.inputFieldPlaceholderField
|
||||||
|
import dev.inmo.tgbotapi.types.inputFieldPlaceholderLimit
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class ReplyForce(
|
data class ReplyForce(
|
||||||
val selective: Boolean? = null
|
val selective: Boolean? = null,
|
||||||
|
@SerialName(inputFieldPlaceholderField)
|
||||||
|
val inputFieldPlaceholder: String? = null
|
||||||
) : KeyboardMarkup {
|
) : KeyboardMarkup {
|
||||||
@SerialName("force_reply")
|
@SerialName("force_reply")
|
||||||
@Required
|
@Required
|
||||||
@ -15,6 +19,12 @@ data class ReplyForce(
|
|||||||
val ReplyForceNonSelective = ReplyForce(false)
|
val ReplyForceNonSelective = ReplyForce(false)
|
||||||
val ReplyForceDefault = ReplyForce()
|
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"))
|
@Deprecated("Renamed", ReplaceWith("ReplyForce", "dev.inmo.tgbotapi.types.buttons.ReplyForce"))
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package dev.inmo.tgbotapi.types.buttons
|
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.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@ -10,5 +12,13 @@ data class ReplyKeyboardMarkup(
|
|||||||
val resizeKeyboard: Boolean? = null,
|
val resizeKeyboard: Boolean? = null,
|
||||||
@SerialName("one_time_keyboard")
|
@SerialName("one_time_keyboard")
|
||||||
val oneTimeKeyboard: Boolean? = null,
|
val oneTimeKeyboard: Boolean? = null,
|
||||||
|
@SerialName(inputFieldPlaceholderField)
|
||||||
|
val inputFieldPlaceholder: String? = null,
|
||||||
val selective: Boolean? = 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,
|
vararg buttons: KeyboardButton,
|
||||||
resizeKeyboard: Boolean? = null,
|
resizeKeyboard: Boolean? = null,
|
||||||
oneTimeKeyboard: Boolean? = null,
|
oneTimeKeyboard: Boolean? = null,
|
||||||
|
inputFieldPlaceholder: String? = null,
|
||||||
selective: Boolean? = null
|
selective: Boolean? = null
|
||||||
): ReplyKeyboardMarkup = ReplyKeyboardMarkup(
|
): ReplyKeyboardMarkup = ReplyKeyboardMarkup(
|
||||||
flatMatrix { buttons.forEach { +it } },
|
flatMatrix { buttons.forEach { +it } },
|
||||||
resizeKeyboard,
|
resizeKeyboard,
|
||||||
oneTimeKeyboard,
|
oneTimeKeyboard,
|
||||||
|
inputFieldPlaceholder,
|
||||||
selective
|
selective
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user