1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-29 21:48:43 +00:00

Compare commits

..

3 Commits

6 changed files with 29 additions and 5 deletions

View File

@ -1,5 +1,11 @@
# TelegramBotAPI changelog # TelegramBotAPI changelog
## 0.38.22
* `Core`:
* New constant `tgWebAppStartParamField`
* All keyboards builders and rows blocks becomes not crossinline
## 0.38.21 ## 0.38.21
* `WebApps`: * `WebApps`:

View File

@ -20,6 +20,6 @@ javax_activation_version=1.1.1
dokka_version=1.6.10 dokka_version=1.6.10
library_group=dev.inmo library_group=dev.inmo
library_version=0.38.21 library_version=0.38.22
github_release_plugin_version=2.3.7 github_release_plugin_version=2.3.7

View File

@ -96,6 +96,8 @@ val telegramInlineModeGifPermittedMimeTypes by lazy {
) )
} }
const val tgWebAppStartParamField = "tgWebAppStartParam"
const val chatIdField = "chat_id" const val chatIdField = "chat_id"
const val senderChatIdField = "sender_chat_id" const val senderChatIdField = "sender_chat_id"
const val messageIdField = "message_id" const val messageIdField = "message_id"

View File

@ -0,0 +1,5 @@
package dev.inmo.tgbotapi.utils.extensions
import dev.inmo.tgbotapi.types.tgWebAppStartParamField
fun createWebAppStartParam(value: String) = tgWebAppStartParamField to value

View File

@ -37,7 +37,7 @@ class InlineKeyboardRowBuilder : RowBuilder<InlineKeyboardButton>()
* @see InlineKeyboardBuilder.row * @see InlineKeyboardBuilder.row
*/ */
inline fun inlineKeyboard( inline fun inlineKeyboard(
crossinline block: InlineKeyboardBuilder.() -> Unit block: InlineKeyboardBuilder.() -> Unit
) = InlineKeyboardBuilder().apply(block).build() ) = InlineKeyboardBuilder().apply(block).build()
/** /**
@ -52,7 +52,7 @@ inline fun inlineKeyboard(
* @see urlButton * @see urlButton
*/ */
inline fun InlineKeyboardBuilder.row( inline fun InlineKeyboardBuilder.row(
crossinline block: InlineKeyboardRowBuilder.() -> Unit block: InlineKeyboardRowBuilder.() -> Unit
) = add(InlineKeyboardRowBuilder().apply(block).row) ) = add(InlineKeyboardRowBuilder().apply(block).row)
/** /**

View File

@ -44,7 +44,7 @@ inline fun replyKeyboard(
oneTimeKeyboard: Boolean? = null, oneTimeKeyboard: Boolean? = null,
inputFieldPlaceholder: String? = null, inputFieldPlaceholder: String? = null,
selective: Boolean? = null, selective: Boolean? = null,
crossinline block: ReplyKeyboardBuilder.() -> Unit block: ReplyKeyboardBuilder.() -> Unit
) = ReplyKeyboardBuilder().apply(block).build(resizeKeyboard, oneTimeKeyboard, inputFieldPlaceholder, selective) ) = ReplyKeyboardBuilder().apply(block).build(resizeKeyboard, oneTimeKeyboard, inputFieldPlaceholder, selective)
/** /**
@ -56,7 +56,7 @@ inline fun replyKeyboard(
* @see requestPollButton * @see requestPollButton
*/ */
inline fun ReplyKeyboardBuilder.row( inline fun ReplyKeyboardBuilder.row(
crossinline block: ReplyKeyboardRowBuilder.() -> Unit block: ReplyKeyboardRowBuilder.() -> Unit
) = add(ReplyKeyboardRowBuilder().apply(block).row) ) = add(ReplyKeyboardRowBuilder().apply(block).row)
/** /**
@ -110,3 +110,14 @@ inline fun ReplyKeyboardRowBuilder.webAppButton(
text: String, text: String,
webApp: WebAppInfo webApp: WebAppInfo
) = add(WebAppKeyboardButton(text, webApp)) ) = 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))