1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-27 20:48:44 +00:00

fixes in copyText keyboard buttons

This commit is contained in:
InsanusMokrassar 2024-11-01 23:10:47 +06:00
parent 479923a04a
commit 636c01acb9
4 changed files with 39 additions and 8 deletions

View File

@ -0,0 +1,8 @@
package dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons
import kotlinx.serialization.Serializable
@Serializable
data class CopyTextButtonData(
val text: String,
)

View File

@ -142,11 +142,13 @@ data class URLInlineKeyboardButton(
) : InlineKeyboardButton
/**
* Simple [url] button. Can be forwarded in any chat with message in case if it is the only one button in message
* `copy_text` button
*/
@Serializable
data class CopyTextButton(
override val text: String
override val text: String,
@SerialName(copyTextField)
val data: CopyTextButtonData
) : InlineKeyboardButton
/**

View File

@ -37,11 +37,20 @@ inline fun loginInlineButton(
) = LoginURLInlineKeyboardButton(text, loginUrl)
/**
* Creates [LoginURLInlineKeyboardButton]
* Creates [CopyTextButton]
*/
inline fun copyTextButton(
text: String
) = CopyTextButton(text)
text: String,
data: CopyTextButtonData
) = CopyTextButton(text, data)
/**
* Creates [CopyTextButton]
*/
inline fun copyTextButton(
text: String,
data: String
) = copyTextButton(text, CopyTextButtonData(data))
/**
* Creates [SwitchInlineQueryCurrentChatInlineKeyboardButton]

View File

@ -93,14 +93,26 @@ inline fun InlineKeyboardRowBuilder.loginButton(
) = add(LoginURLInlineKeyboardButton(text, loginUrl))
/**
* Creates and put [LoginURLInlineKeyboardButton]
* Creates [CopyTextButton]
*
* @see inlineKeyboard
* @see InlineKeyboardBuilder.row
*/
inline fun InlineKeyboardRowBuilder.copyTextButton(
text: String
) = add(CopyTextButton(text))
text: String,
data: CopyTextButtonData
) = add(CopyTextButton(text, data))
/**
* Creates [CopyTextButton]
*
* @see inlineKeyboard
* @see InlineKeyboardBuilder.row
*/
inline fun InlineKeyboardRowBuilder.copyTextButton(
text: String,
data: String
) = copyTextButton(text, CopyTextButtonData(data))
/**
* Creates and put [SwitchInlineQueryCurrentChatInlineKeyboardButton]