mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 00:03:48 +00:00
add ReplyKeyboardMarkup
This commit is contained in:
parent
c882717bcc
commit
8df8b87d54
@ -461,6 +461,7 @@ const val shouldSendEmailToProviderField = "send_email_to_provider"
|
||||
const val resizeKeyboardField = "resize_keyboard"
|
||||
const val oneTimeKeyboardField = "one_time_keyboard"
|
||||
const val inputFieldPlaceholderField = "input_field_placeholder"
|
||||
const val isPersistentField = "is_persistent"
|
||||
|
||||
const val priceDependOnShipAddressField = "is_flexible"
|
||||
|
||||
|
@ -13,7 +13,9 @@ data class ReplyKeyboardMarkup(
|
||||
val oneTimeKeyboard: Boolean? = null,
|
||||
@SerialName(inputFieldPlaceholderField)
|
||||
val inputFieldPlaceholder: String? = null,
|
||||
val selective: Boolean? = null
|
||||
val selective: Boolean? = null,
|
||||
@SerialName(isPersistentField)
|
||||
val persistent: Boolean? = null
|
||||
) : KeyboardMarkup {
|
||||
init {
|
||||
if (inputFieldPlaceholder != null && inputFieldPlaceholder.length !in inputFieldPlaceholderLimit) {
|
||||
|
@ -22,7 +22,8 @@ fun ReplyKeyboardBuilder.build(
|
||||
oneTimeKeyboard: Boolean? = null,
|
||||
inputFieldPlaceholder: String? = null,
|
||||
selective: Boolean? = null,
|
||||
) = ReplyKeyboardMarkup(matrix, resizeKeyboard, oneTimeKeyboard, inputFieldPlaceholder, selective)
|
||||
persistent: Boolean? = null,
|
||||
) = ReplyKeyboardMarkup(matrix, resizeKeyboard, oneTimeKeyboard, inputFieldPlaceholder, selective, persistent)
|
||||
|
||||
/**
|
||||
* Row builder of [KeyboardButton]
|
||||
@ -43,8 +44,9 @@ inline fun replyKeyboard(
|
||||
oneTimeKeyboard: Boolean? = null,
|
||||
inputFieldPlaceholder: String? = null,
|
||||
selective: Boolean? = null,
|
||||
persistent: Boolean? = null,
|
||||
block: ReplyKeyboardBuilder.() -> Unit
|
||||
) = ReplyKeyboardBuilder().apply(block).build(resizeKeyboard, oneTimeKeyboard, inputFieldPlaceholder, selective)
|
||||
) = ReplyKeyboardBuilder().apply(block).build(resizeKeyboard, oneTimeKeyboard, inputFieldPlaceholder, selective, persistent)
|
||||
|
||||
/**
|
||||
* Factory-function for [ReplyKeyboardBuilder], but in difference with [replyKeyboard] this method will create single-row
|
||||
@ -55,8 +57,9 @@ inline fun flatReplyKeyboard(
|
||||
oneTimeKeyboard: Boolean? = null,
|
||||
inputFieldPlaceholder: String? = null,
|
||||
selective: Boolean? = null,
|
||||
persistent: Boolean? = null,
|
||||
block: ReplyKeyboardRowBuilder.() -> Unit
|
||||
) = replyKeyboard(resizeKeyboard, oneTimeKeyboard, inputFieldPlaceholder, selective) {
|
||||
) = replyKeyboard(resizeKeyboard, oneTimeKeyboard, inputFieldPlaceholder, selective, persistent) {
|
||||
row<KeyboardButton>(block)
|
||||
}
|
||||
|
||||
|
@ -9,11 +9,13 @@ fun ReplyKeyboardMarkup(
|
||||
resizeKeyboard: Boolean? = null,
|
||||
oneTimeKeyboard: Boolean? = null,
|
||||
inputFieldPlaceholder: String? = null,
|
||||
selective: Boolean? = null
|
||||
selective: Boolean? = null,
|
||||
persistent: Boolean? = null
|
||||
): ReplyKeyboardMarkup = ReplyKeyboardMarkup(
|
||||
flatMatrix { buttons.forEach { +it } },
|
||||
resizeKeyboard,
|
||||
oneTimeKeyboard,
|
||||
inputFieldPlaceholder,
|
||||
selective
|
||||
selective,
|
||||
persistent
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user