eu.vendeli.tgbot.interfaces.InlineMode.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of telegram-bot Show documentation
Show all versions of telegram-bot Show documentation
Telegram Bot API wrapper, with handy Kotlin DSL.
package eu.vendeli.tgbot.interfaces
import eu.vendeli.tgbot.TelegramBot
import eu.vendeli.tgbot.types.internal.Response
import eu.vendeli.tgbot.utils.makeRequestAsync
import eu.vendeli.tgbot.utils.makeSilentRequest
import kotlinx.coroutines.Deferred
/**
* Provides the ability to do inline request.
*
* @param ReturnType
*/
interface InlineMode : TgAction, IActionState {
/**
* Make inline request for action.
*
* @param inlineMessageId Identifier of the inline message
* @param via Instance of the bot through which the request will be made.
*/
suspend fun sendInline(inlineMessageId: String, via: TelegramBot) {
parameters["inline_message_id"] = inlineMessageId
via.makeSilentRequest(method, parameters)
}
/**
* Make a request for action returning its [Response].
*
* @param inlineMessageId Identifier of the inline message
* @param via Instance of the bot through which the request will be made.
*/
suspend fun sendInlineAsync(
inlineMessageId: String,
via: TelegramBot,
): Deferred> {
parameters["inline_message_id"] = inlineMessageId
return via.makeRequestAsync(method, parameters, returnType, wrappedDataType)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy