mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-08 17:33:47 +00:00
fixes in copyText keyboard buttons
This commit is contained in:
parent
479923a04a
commit
636c01acb9
@ -0,0 +1,8 @@
|
||||
package dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class CopyTextButtonData(
|
||||
val text: String,
|
||||
)
|
@ -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
|
||||
|
||||
/**
|
||||
|
@ -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]
|
||||
|
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user