1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 08:13:47 +00:00

flatInlineKeyboard and flatReplyKeyboard

This commit is contained in:
InsanusMokrassar 2022-07-11 01:10:35 +06:00
parent 3d7334dd62
commit 3f9237b5de
3 changed files with 25 additions and 0 deletions

View File

@ -9,6 +9,7 @@
* `Utils`:
* New extension `Message#sameChat`
* New extension `Message#sameMessage`
* New functions `flatInlineKeyboard` and `flatReplyKeyboard`
## 2.1.3

View File

@ -40,6 +40,16 @@ inline fun inlineKeyboard(
block: InlineKeyboardBuilder.() -> Unit
) = InlineKeyboardBuilder().apply(block).build()
/**
* Factory-function for [InlineKeyboardBuilder], but in difference with [inlineKeyboard] this function will create single-row
* inline keyboard
*
* @see InlineKeyboardBuilder.row
*/
inline fun flatInlineKeyboard(
block: InlineKeyboardRowBuilder.() -> Unit
) = inlineKeyboard { row(block) }
/**
* Creates an [InlineKeyboardRowBuilder] and [apply] [block] with this builder
*

View File

@ -47,6 +47,20 @@ inline fun replyKeyboard(
block: ReplyKeyboardBuilder.() -> Unit
) = ReplyKeyboardBuilder().apply(block).build(resizeKeyboard, oneTimeKeyboard, inputFieldPlaceholder, selective)
/**
* Factory-function for [ReplyKeyboardBuilder], but in difference with [replyKeyboard] this method will create single-row
* keyboard
*/
inline fun flatReplyKeyboard(
resizeKeyboard: Boolean? = null,
oneTimeKeyboard: Boolean? = null,
inputFieldPlaceholder: String? = null,
selective: Boolean? = null,
block: ReplyKeyboardRowBuilder.() -> Unit
) = replyKeyboard(resizeKeyboard, oneTimeKeyboard, inputFieldPlaceholder, selective) {
row(block)
}
/**
* Creates an [ReplyKeyboardRowBuilder] and [apply] [block] with this builder
*