mirror of
				https://github.com/InsanusMokrassar/TelegramBotAPI-examples.git
				synced 2025-11-04 14:10:51 +00:00 
			
		
		
		
	in keyboards bot add sample with sending of inline query
This commit is contained in:
		@@ -7,6 +7,7 @@ import dev.inmo.tgbotapi.extensions.api.send.*
 | 
			
		||||
import dev.inmo.tgbotapi.extensions.api.telegramBot
 | 
			
		||||
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.types.BotCommand
 | 
			
		||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultArticle
 | 
			
		||||
@@ -73,6 +74,7 @@ suspend fun main(vararg args: String) {
 | 
			
		||||
    bot.buildBehaviourWithLongPolling(
 | 
			
		||||
        defaultExceptionsHandler = { it.printStackTrace() }
 | 
			
		||||
    ) {
 | 
			
		||||
        val me = getMe()
 | 
			
		||||
        onCommand("reply_markup") {
 | 
			
		||||
            reply(
 | 
			
		||||
                it,
 | 
			
		||||
@@ -97,6 +99,18 @@ suspend fun main(vararg args: String) {
 | 
			
		||||
 | 
			
		||||
            )
 | 
			
		||||
        }
 | 
			
		||||
        onCommand("attachment_menu") {
 | 
			
		||||
            reply(
 | 
			
		||||
                it,
 | 
			
		||||
                ,
 | 
			
		||||
                replyMarkup = inlineKeyboard {
 | 
			
		||||
                    row {
 | 
			
		||||
                        webAppButton("Open WebApp", WebAppInfo(args[1]))
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
            )
 | 
			
		||||
        }
 | 
			
		||||
        onUnhandledCommand {
 | 
			
		||||
            reply(
 | 
			
		||||
                it,
 | 
			
		||||
@@ -106,6 +120,9 @@ suspend fun main(vararg args: String) {
 | 
			
		||||
                }
 | 
			
		||||
            )
 | 
			
		||||
        }
 | 
			
		||||
        onWriteAccessAllowed(initialFilter = { it.chatEvent.webAppName != null }) {
 | 
			
		||||
            send(it.chat, "Thanks for adding ${it.chatEvent.webAppName} to the attachment menu")
 | 
			
		||||
        }
 | 
			
		||||
        setMyCommands(
 | 
			
		||||
            BotCommand("reply_markup", "Use to get reply markup keyboard with web app trigger"),
 | 
			
		||||
            BotCommand("inline", "Use to get inline keyboard with web app trigger"),
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user