mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-09-16 13:49:26 +00:00
keyboard builders become typealiases
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
package dev.inmo.tgbotapi.types.buttons.inline
|
||||
|
||||
import dev.inmo.tgbotapi.types.LoginURL
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.*
|
||||
import dev.inmo.tgbotapi.types.webapps.WebAppInfo
|
||||
|
||||
/**
|
||||
* Creates and put [PayInlineKeyboardButton]
|
||||
*
|
||||
* @see inlineKeyboard
|
||||
* @see InlineKeyboardBuilder.row
|
||||
*/
|
||||
inline fun payInlineButton(
|
||||
text: String
|
||||
) = PayInlineKeyboardButton(text)
|
||||
|
||||
/**
|
||||
* Creates and put [CallbackDataInlineKeyboardButton]
|
||||
*
|
||||
* @see inlineKeyboard
|
||||
* @see InlineKeyboardBuilder.row
|
||||
*/
|
||||
inline fun dataInlineButton(
|
||||
text: String,
|
||||
data: String
|
||||
) = CallbackDataInlineKeyboardButton(text, data)
|
||||
|
||||
/**
|
||||
* Creates and put [CallbackGameInlineKeyboardButton]
|
||||
*
|
||||
* @see inlineKeyboard
|
||||
* @see InlineKeyboardBuilder.row
|
||||
*/
|
||||
inline fun gameInlineButton(
|
||||
text: String
|
||||
) = CallbackGameInlineKeyboardButton(text)
|
||||
|
||||
/**
|
||||
* Creates and put [LoginURLInlineKeyboardButton]
|
||||
*
|
||||
* @see inlineKeyboard
|
||||
* @see InlineKeyboardBuilder.row
|
||||
*/
|
||||
inline fun loginInlineButton(
|
||||
text: String,
|
||||
loginUrl: LoginURL
|
||||
) = LoginURLInlineKeyboardButton(text, loginUrl)
|
||||
|
||||
/**
|
||||
* Creates and put [SwitchInlineQueryCurrentChatInlineKeyboardButton]
|
||||
*
|
||||
* @see inlineKeyboard
|
||||
* @see InlineKeyboardBuilder.row
|
||||
*/
|
||||
inline fun inlineQueryInCurrentChatInlineButton(
|
||||
text: String,
|
||||
data: String
|
||||
) = SwitchInlineQueryCurrentChatInlineKeyboardButton(text, data)
|
||||
|
||||
/**
|
||||
* Creates and put [SwitchInlineQueryInlineKeyboardButton]
|
||||
*
|
||||
* @see inlineKeyboard
|
||||
* @see InlineKeyboardBuilder.row
|
||||
*/
|
||||
inline fun inlineQueryInlineButton(
|
||||
text: String,
|
||||
data: String
|
||||
) = SwitchInlineQueryInlineKeyboardButton(text, data)
|
||||
|
||||
/**
|
||||
* Creates and put [URLInlineKeyboardButton]
|
||||
*
|
||||
* @see inlineKeyboard
|
||||
* @see InlineKeyboardBuilder.row
|
||||
*/
|
||||
inline fun urlInlineButton(
|
||||
text: String,
|
||||
url: String
|
||||
) = URLInlineKeyboardButton(text, url)
|
||||
|
||||
/**
|
||||
* Creates and put [WebAppInlineKeyboardButton]. Please, remember that this button is available in private chats only
|
||||
*
|
||||
* @see inlineKeyboard
|
||||
* @see InlineKeyboardBuilder.row
|
||||
*/
|
||||
inline fun webAppInlineButton(
|
||||
text: String,
|
||||
webApp: WebAppInfo
|
||||
) = WebAppInlineKeyboardButton(text, webApp)
|
||||
|
||||
/**
|
||||
* Creates and put [WebAppInlineKeyboardButton]. Please, remember that this button is available in private chats only
|
||||
*
|
||||
* @see inlineKeyboard
|
||||
* @see InlineKeyboardBuilder.row
|
||||
*/
|
||||
inline fun webAppInlineButton(
|
||||
text: String,
|
||||
url: String
|
||||
) = webAppInlineButton(text, WebAppInfo(url))
|
@@ -0,0 +1,69 @@
|
||||
package dev.inmo.tgbotapi.types.buttons.reply
|
||||
|
||||
import dev.inmo.tgbotapi.types.buttons.*
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.*
|
||||
import dev.inmo.tgbotapi.types.webapps.WebAppInfo
|
||||
|
||||
|
||||
/**
|
||||
* Creates and put [SimpleKeyboardButton]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
*/
|
||||
inline fun simpleReplyButton(
|
||||
text: String
|
||||
) = SimpleKeyboardButton(text)
|
||||
|
||||
/**
|
||||
* Creates and put [RequestContactKeyboardButton]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
*/
|
||||
inline fun requestContactReplyButton(
|
||||
text: String
|
||||
) = RequestContactKeyboardButton(text)
|
||||
|
||||
/**
|
||||
* Creates and put [RequestLocationKeyboardButton]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
*/
|
||||
inline fun requestLocationReplyButton(
|
||||
text: String
|
||||
) = RequestLocationKeyboardButton(text)
|
||||
|
||||
/**
|
||||
* Creates and put [RequestPollKeyboardButton]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
*/
|
||||
inline fun requestPollReplyButton(
|
||||
text: String,
|
||||
pollType: KeyboardButtonPollType
|
||||
) = RequestPollKeyboardButton(text, pollType)
|
||||
|
||||
/**
|
||||
* Creates and put [WebAppKeyboardButton]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
*/
|
||||
inline fun webAppReplyButton(
|
||||
text: String,
|
||||
webApp: WebAppInfo
|
||||
) = WebAppKeyboardButton(text, webApp)
|
||||
|
||||
/**
|
||||
* Creates and put [WebAppKeyboardButton]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
*/
|
||||
inline fun webAppReplyButton(
|
||||
text: String,
|
||||
url: String
|
||||
) = webAppReplyButton(text, WebAppInfo(url))
|
Reference in New Issue
Block a user