mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-09-03 23:29:33 +00:00
fixes in keyboards
This commit is contained in:
@@ -3,6 +3,12 @@ package dev.inmo.tgbotapi.extensions.utils.types.buttons
|
||||
import dev.inmo.tgbotapi.types.LoginURL
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.*
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardButtonRequestChat
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardButtonRequestUser
|
||||
import dev.inmo.tgbotapi.types.buttons.inline.requestChatInlineButton
|
||||
import dev.inmo.tgbotapi.types.buttons.inline.requestUserInlineButton
|
||||
import dev.inmo.tgbotapi.types.chat.member.ChatAdministratorRights
|
||||
import dev.inmo.tgbotapi.types.request.RequestId
|
||||
import dev.inmo.tgbotapi.types.webapps.WebAppInfo
|
||||
import dev.inmo.tgbotapi.utils.*
|
||||
|
||||
@@ -161,3 +167,103 @@ inline fun InlineKeyboardRowBuilder.webAppButton(
|
||||
text: String,
|
||||
url: String
|
||||
) = webAppButton(text, WebAppInfo(url))
|
||||
|
||||
|
||||
/**
|
||||
* Creates and put [RequestUserKeyboardButton]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
*/
|
||||
inline fun InlineKeyboardRowBuilder.requestUserButton(
|
||||
text: String,
|
||||
requestUser: KeyboardButtonRequestUser
|
||||
) = add(
|
||||
requestUserInlineButton(
|
||||
text,
|
||||
requestUser
|
||||
)
|
||||
)
|
||||
|
||||
/**
|
||||
* Creates and put [RequestUserKeyboardButton] with [KeyboardButtonRequestUser.Bot]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
*/
|
||||
inline fun InlineKeyboardRowBuilder.requestBotButton(
|
||||
text: String,
|
||||
requestId: RequestId
|
||||
) = requestUserButton(
|
||||
text,
|
||||
KeyboardButtonRequestUser.Bot(requestId)
|
||||
)
|
||||
|
||||
/**
|
||||
* Creates and put [RequestUserKeyboardButton] with [KeyboardButtonRequestUser.Common]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
*/
|
||||
inline fun InlineKeyboardRowBuilder.requestUserButton(
|
||||
text: String,
|
||||
requestId: RequestId,
|
||||
premiumUser: Boolean? = null
|
||||
) = requestUserButton(
|
||||
text,
|
||||
KeyboardButtonRequestUser.Common(requestId, premiumUser)
|
||||
)
|
||||
|
||||
/**
|
||||
* Creates and put [RequestUserKeyboardButton] with [KeyboardButtonRequestUser.Any]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
*/
|
||||
inline fun InlineKeyboardRowBuilder.requestUserOrBotButton(
|
||||
text: String,
|
||||
requestId: RequestId
|
||||
) = requestUserButton(
|
||||
text,
|
||||
KeyboardButtonRequestUser.Any(requestId)
|
||||
)
|
||||
|
||||
|
||||
/**
|
||||
* Creates and put [RequestChatKeyboardButton]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
*/
|
||||
inline fun InlineKeyboardRowBuilder.requestChatButton(
|
||||
text: String,
|
||||
requestChat: KeyboardButtonRequestChat
|
||||
) = add(
|
||||
requestChatInlineButton(
|
||||
text,
|
||||
requestChat
|
||||
)
|
||||
)
|
||||
|
||||
/**
|
||||
* Creates and put [RequestChatKeyboardButton] with [KeyboardButtonRequestChat]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
*/
|
||||
inline fun InlineKeyboardRowBuilder.requestChatButton(
|
||||
text: String,
|
||||
requestId: RequestId,
|
||||
isChannel: Boolean? = null,
|
||||
isForum: Boolean? = null,
|
||||
withUsername: Boolean? = null,
|
||||
ownedBy: Boolean? = null,
|
||||
userRightsInChat: ChatAdministratorRights? = null,
|
||||
botRightsInChat: ChatAdministratorRights? = null,
|
||||
botIsMember: Boolean = false
|
||||
) = requestChatButton(
|
||||
text,
|
||||
KeyboardButtonRequestChat(
|
||||
requestId, isChannel, isForum, withUsername, ownedBy, userRightsInChat, botRightsInChat, botIsMember
|
||||
)
|
||||
)
|
||||
|
@@ -1,10 +1,6 @@
|
||||
package dev.inmo.tgbotapi.extensions.utils.types.buttons
|
||||
|
||||
import dev.inmo.tgbotapi.types.buttons.*
|
||||
import dev.inmo.tgbotapi.types.buttons.reply.requestChatReplyButton
|
||||
import dev.inmo.tgbotapi.types.buttons.reply.requestUserReplyButton
|
||||
import dev.inmo.tgbotapi.types.chat.member.ChatAdministratorRights
|
||||
import dev.inmo.tgbotapi.types.request.RequestId
|
||||
import dev.inmo.tgbotapi.types.webapps.WebAppInfo
|
||||
import dev.inmo.tgbotapi.utils.*
|
||||
|
||||
@@ -142,103 +138,3 @@ inline fun ReplyKeyboardRowBuilder.webAppButton(
|
||||
text: String,
|
||||
url: String
|
||||
) = webAppButton(text, WebAppInfo(url))
|
||||
|
||||
|
||||
/**
|
||||
* Creates and put [RequestUserKeyboardButton]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
*/
|
||||
inline fun ReplyKeyboardRowBuilder.requestUserButton(
|
||||
text: String,
|
||||
requestUser: KeyboardButtonRequestUser
|
||||
) = add(
|
||||
requestUserReplyButton(
|
||||
text,
|
||||
requestUser
|
||||
)
|
||||
)
|
||||
|
||||
/**
|
||||
* Creates and put [RequestUserKeyboardButton] with [KeyboardButtonRequestUser.Bot]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
*/
|
||||
inline fun ReplyKeyboardRowBuilder.requestBotButton(
|
||||
text: String,
|
||||
requestId: RequestId
|
||||
) = requestUserButton(
|
||||
text,
|
||||
KeyboardButtonRequestUser.Bot(requestId)
|
||||
)
|
||||
|
||||
/**
|
||||
* Creates and put [RequestUserKeyboardButton] with [KeyboardButtonRequestUser.Common]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
*/
|
||||
inline fun ReplyKeyboardRowBuilder.requestUserButton(
|
||||
text: String,
|
||||
requestId: RequestId,
|
||||
premiumUser: Boolean? = null
|
||||
) = requestUserButton(
|
||||
text,
|
||||
KeyboardButtonRequestUser.Common(requestId, premiumUser)
|
||||
)
|
||||
|
||||
/**
|
||||
* Creates and put [RequestUserKeyboardButton] with [KeyboardButtonRequestUser.Any]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
*/
|
||||
inline fun ReplyKeyboardRowBuilder.requestUserOrBotButton(
|
||||
text: String,
|
||||
requestId: RequestId
|
||||
) = requestUserButton(
|
||||
text,
|
||||
KeyboardButtonRequestUser.Any(requestId)
|
||||
)
|
||||
|
||||
|
||||
/**
|
||||
* Creates and put [RequestChatKeyboardButton]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
*/
|
||||
inline fun ReplyKeyboardRowBuilder.requestChatButton(
|
||||
text: String,
|
||||
requestChat: KeyboardButtonRequestChat
|
||||
) = add(
|
||||
requestChatReplyButton(
|
||||
text,
|
||||
requestChat
|
||||
)
|
||||
)
|
||||
|
||||
/**
|
||||
* Creates and put [RequestChatKeyboardButton] with [KeyboardButtonRequestChat]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
*/
|
||||
inline fun ReplyKeyboardRowBuilder.requestChatButton(
|
||||
text: String,
|
||||
requestId: RequestId,
|
||||
isChannel: Boolean? = null,
|
||||
isForum: Boolean? = null,
|
||||
withUsername: Boolean? = null,
|
||||
ownedBy: Boolean? = null,
|
||||
userRightsInChat: ChatAdministratorRights? = null,
|
||||
botRightsInChat: ChatAdministratorRights? = null,
|
||||
botIsMember: Boolean = false
|
||||
) = requestChatButton(
|
||||
text,
|
||||
KeyboardButtonRequestChat(
|
||||
requestId, isChannel, isForum, withUsername, ownedBy, userRightsInChat, botRightsInChat, botIsMember
|
||||
)
|
||||
)
|
||||
|
Reference in New Issue
Block a user