1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2026-04-07 10:32:44 +00:00

add support of PreparedKeyboardButton and savePreparedKeyboardButton

This commit is contained in:
2026-04-06 16:11:46 +06:00
parent de13ddeb54
commit a0e748f9a9
7 changed files with 188 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
package dev.inmo.tgbotapi.extensions.api
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.SavePreparedKeyboardButton
import dev.inmo.tgbotapi.types.ChatId
import dev.inmo.tgbotapi.types.buttons.KeyboardButton
import dev.inmo.tgbotapi.types.buttons.PreparedKeyboardButton
import dev.inmo.tgbotapi.types.chat.User
import dev.inmo.tgbotapi.types.toChatId
public suspend fun TelegramBot.savePreparedKeyboardButton(
userId: ChatId,
button: KeyboardButton
): PreparedKeyboardButton = execute(
SavePreparedKeyboardButton(userId = userId, button = button)
)
public suspend fun TelegramBot.savePreparedKeyboardButton(
user: User,
button: KeyboardButton
): PreparedKeyboardButton = savePreparedKeyboardButton(userId = user.id.toChatId(), button = button)