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
|
) : 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
|
@Serializable
|
||||||
data class CopyTextButton(
|
data class CopyTextButton(
|
||||||
override val text: String
|
override val text: String,
|
||||||
|
@SerialName(copyTextField)
|
||||||
|
val data: CopyTextButtonData
|
||||||
) : InlineKeyboardButton
|
) : InlineKeyboardButton
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,11 +37,20 @@ inline fun loginInlineButton(
|
|||||||
) = LoginURLInlineKeyboardButton(text, loginUrl)
|
) = LoginURLInlineKeyboardButton(text, loginUrl)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates [LoginURLInlineKeyboardButton]
|
* Creates [CopyTextButton]
|
||||||
*/
|
*/
|
||||||
inline fun copyTextButton(
|
inline fun copyTextButton(
|
||||||
text: String
|
text: String,
|
||||||
) = CopyTextButton(text)
|
data: CopyTextButtonData
|
||||||
|
) = CopyTextButton(text, data)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates [CopyTextButton]
|
||||||
|
*/
|
||||||
|
inline fun copyTextButton(
|
||||||
|
text: String,
|
||||||
|
data: String
|
||||||
|
) = copyTextButton(text, CopyTextButtonData(data))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates [SwitchInlineQueryCurrentChatInlineKeyboardButton]
|
* Creates [SwitchInlineQueryCurrentChatInlineKeyboardButton]
|
||||||
|
@ -93,14 +93,26 @@ inline fun InlineKeyboardRowBuilder.loginButton(
|
|||||||
) = add(LoginURLInlineKeyboardButton(text, loginUrl))
|
) = add(LoginURLInlineKeyboardButton(text, loginUrl))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates and put [LoginURLInlineKeyboardButton]
|
* Creates [CopyTextButton]
|
||||||
*
|
*
|
||||||
* @see inlineKeyboard
|
* @see inlineKeyboard
|
||||||
* @see InlineKeyboardBuilder.row
|
* @see InlineKeyboardBuilder.row
|
||||||
*/
|
*/
|
||||||
inline fun InlineKeyboardRowBuilder.copyTextButton(
|
inline fun InlineKeyboardRowBuilder.copyTextButton(
|
||||||
text: String
|
text: String,
|
||||||
) = add(CopyTextButton(text))
|
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]
|
* Creates and put [SwitchInlineQueryCurrentChatInlineKeyboardButton]
|
||||||
|
Loading…
Reference in New Issue
Block a user