add answerInlineQuery with WebAppInfo

This commit is contained in:
InsanusMokrassar 2023-04-22 11:06:03 +06:00
parent eccbe71e68
commit 3e2ccf9cf1
2 changed files with 13 additions and 2 deletions

View File

@ -1,6 +1,7 @@
import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions
import dev.inmo.micro_utils.ktor.server.createKtorServer
import dev.inmo.tgbotapi.extensions.api.answers.answer
import dev.inmo.tgbotapi.extensions.api.answers.answerInlineQuery
import dev.inmo.tgbotapi.extensions.api.bot.getMe
import dev.inmo.tgbotapi.extensions.api.bot.setMyCommands
import dev.inmo.tgbotapi.extensions.api.send.*
@ -9,6 +10,7 @@ import dev.inmo.tgbotapi.extensions.behaviour_builder.*
import dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling.*
import dev.inmo.tgbotapi.extensions.utils.formatting.makeTelegramStartattach
import dev.inmo.tgbotapi.extensions.utils.types.buttons.*
import dev.inmo.tgbotapi.requests.answers.InlineQueryResultsButton
import dev.inmo.tgbotapi.types.BotCommand
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultArticle
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputTextMessageContent
@ -102,7 +104,7 @@ suspend fun main(vararg args: String) {
onCommand("attachment_menu") {
reply(
it,
,
"Button",
replyMarkup = inlineKeyboard {
row {
webAppButton("Open WebApp", WebAppInfo(args[1]))
@ -111,6 +113,15 @@ suspend fun main(vararg args: String) {
)
}
onBaseInlineQuery {
answerInlineQuery(
it,
button = InlineQueryResultsButton.invoke(
"Open webApp",
WebAppInfo(args[1])
)
)
}
onUnhandledCommand {
reply(
it,

View File

@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx2g
kotlin_version=1.8.20
telegram_bot_api_version=7.1.0-branch_7.1.0-build1602
telegram_bot_api_version=7.1.0-branch_7.1.0-build1610
micro_utils_version=0.17.8
serialization_version=1.5.0
ktor_version=2.3.0