mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
improvements in keyboards and add tgWebAppStartParamField
This commit is contained in:
parent
52f405c3b1
commit
233c789054
@ -2,6 +2,10 @@
|
||||
|
||||
## 0.38.22
|
||||
|
||||
* `Core`:
|
||||
* New constant `tgWebAppStartParamField`
|
||||
* All keyboards builders and rows blocks becomes not crossinline
|
||||
|
||||
## 0.38.21
|
||||
|
||||
* `WebApps`:
|
||||
|
@ -96,6 +96,8 @@ val telegramInlineModeGifPermittedMimeTypes by lazy {
|
||||
)
|
||||
}
|
||||
|
||||
const val tgWebAppStartParamField = "tgWebAppStartParam"
|
||||
|
||||
const val chatIdField = "chat_id"
|
||||
const val senderChatIdField = "sender_chat_id"
|
||||
const val messageIdField = "message_id"
|
||||
|
@ -0,0 +1,5 @@
|
||||
package dev.inmo.tgbotapi.utils.extensions
|
||||
|
||||
import dev.inmo.tgbotapi.types.tgWebAppStartParamField
|
||||
|
||||
fun createWebAppStartParam(value: String) = tgWebAppStartParamField to value
|
@ -37,7 +37,7 @@ class InlineKeyboardRowBuilder : RowBuilder<InlineKeyboardButton>()
|
||||
* @see InlineKeyboardBuilder.row
|
||||
*/
|
||||
inline fun inlineKeyboard(
|
||||
crossinline block: InlineKeyboardBuilder.() -> Unit
|
||||
block: InlineKeyboardBuilder.() -> Unit
|
||||
) = InlineKeyboardBuilder().apply(block).build()
|
||||
|
||||
/**
|
||||
@ -52,7 +52,7 @@ inline fun inlineKeyboard(
|
||||
* @see urlButton
|
||||
*/
|
||||
inline fun InlineKeyboardBuilder.row(
|
||||
crossinline block: InlineKeyboardRowBuilder.() -> Unit
|
||||
block: InlineKeyboardRowBuilder.() -> Unit
|
||||
) = add(InlineKeyboardRowBuilder().apply(block).row)
|
||||
|
||||
/**
|
||||
|
@ -44,7 +44,7 @@ inline fun replyKeyboard(
|
||||
oneTimeKeyboard: Boolean? = null,
|
||||
inputFieldPlaceholder: String? = null,
|
||||
selective: Boolean? = null,
|
||||
crossinline block: ReplyKeyboardBuilder.() -> Unit
|
||||
block: ReplyKeyboardBuilder.() -> Unit
|
||||
) = ReplyKeyboardBuilder().apply(block).build(resizeKeyboard, oneTimeKeyboard, inputFieldPlaceholder, selective)
|
||||
|
||||
/**
|
||||
@ -56,7 +56,7 @@ inline fun replyKeyboard(
|
||||
* @see requestPollButton
|
||||
*/
|
||||
inline fun ReplyKeyboardBuilder.row(
|
||||
crossinline block: ReplyKeyboardRowBuilder.() -> Unit
|
||||
block: ReplyKeyboardRowBuilder.() -> Unit
|
||||
) = add(ReplyKeyboardRowBuilder().apply(block).row)
|
||||
|
||||
/**
|
||||
@ -110,3 +110,14 @@ inline fun ReplyKeyboardRowBuilder.webAppButton(
|
||||
text: String,
|
||||
webApp: WebAppInfo
|
||||
) = add(WebAppKeyboardButton(text, webApp))
|
||||
|
||||
/**
|
||||
* Creates and put [WebAppKeyboardButton]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
*/
|
||||
inline fun ReplyKeyboardRowBuilder.webAppButton(
|
||||
text: String,
|
||||
url: String
|
||||
) = webAppButton(text, WebAppInfo(url))
|
||||
|
Loading…
Reference in New Issue
Block a user