1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-09-03 23:29:33 +00:00

keyboard builders become typealiases

This commit is contained in:
2022-09-28 20:38:16 +06:00
parent 959f0dffba
commit 8b64a0c94e
5 changed files with 197 additions and 19 deletions

View File

@@ -15,12 +15,12 @@ import dev.inmo.tgbotapi.utils.RowBuilder
* @see InlineKeyboardBuilder.row
* @see InlineKeyboardRowBuilder
*/
class InlineKeyboardBuilder : MatrixBuilder<InlineKeyboardButton>() {
/**
* Creates [InlineKeyboardMarkup] using internal [matrix]
*/
fun build() = InlineKeyboardMarkup(matrix)
}
typealias InlineKeyboardBuilder = MatrixBuilder<InlineKeyboardButton>
/**
* Creates [InlineKeyboardMarkup] using internal [matrix]
*/
fun InlineKeyboardBuilder.build() = InlineKeyboardMarkup(matrix)
/**
* Row builder of [InlineKeyboardBuilder]
@@ -28,7 +28,7 @@ class InlineKeyboardBuilder : MatrixBuilder<InlineKeyboardButton>() {
* @see inlineKeyboard
* @see InlineKeyboardBuilder.row
*/
class InlineKeyboardRowBuilder : RowBuilder<InlineKeyboardButton>()
typealias InlineKeyboardRowBuilder = RowBuilder<InlineKeyboardButton>
/**
* Factory-function for [InlineKeyboardBuilder]. It will [apply] [block] to internally created [InlineKeyboardMarkup]

View File

@@ -13,17 +13,17 @@ import dev.inmo.tgbotapi.utils.RowBuilder
* @see ReplyKeyboardBuilder.row
* @see ReplyKeyboardRowBuilder
*/
class ReplyKeyboardBuilder : MatrixBuilder<KeyboardButton>() {
/**
* Creates [InlineKeyboardMarkup] using internal [matrix]
*/
fun build(
resizeKeyboard: Boolean? = null,
oneTimeKeyboard: Boolean? = null,
inputFieldPlaceholder: String? = null,
selective: Boolean? = null,
) = ReplyKeyboardMarkup(matrix, resizeKeyboard, oneTimeKeyboard, inputFieldPlaceholder, selective)
}
typealias ReplyKeyboardBuilder = MatrixBuilder<KeyboardButton>
/**
* Creates [InlineKeyboardMarkup] using internal [matrix]
*/
fun ReplyKeyboardBuilder.build(
resizeKeyboard: Boolean? = null,
oneTimeKeyboard: Boolean? = null,
inputFieldPlaceholder: String? = null,
selective: Boolean? = null,
) = ReplyKeyboardMarkup(matrix, resizeKeyboard, oneTimeKeyboard, inputFieldPlaceholder, selective)
/**
* Row builder of [KeyboardButton]
@@ -31,7 +31,7 @@ class ReplyKeyboardBuilder : MatrixBuilder<KeyboardButton>() {
* @see replyKeyboard
* @see ReplyKeyboardBuilder.row
*/
class ReplyKeyboardRowBuilder : RowBuilder<KeyboardButton>()
typealias ReplyKeyboardRowBuilder = RowBuilder<KeyboardButton>
/**
* Factory-function for [ReplyKeyboardBuilder]. It will [apply] [block] to internally created [ReplyKeyboardMarkup]