mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
add support of SentWebAppMessage
This commit is contained in:
parent
22a7697447
commit
4ffe6f915f
@ -0,0 +1,16 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.answers
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.answers.AnswerWebAppQuery
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult
|
||||
import dev.inmo.tgbotapi.types.WebAppQueryId
|
||||
|
||||
suspend fun TelegramBot.answerWebAppQuery(
|
||||
webAppQueryId: WebAppQueryId,
|
||||
result: InlineQueryResult
|
||||
) = execute(AnswerWebAppQuery(webAppQueryId, result))
|
||||
|
||||
suspend fun TelegramBot.answer(
|
||||
webAppQueryId: WebAppQueryId,
|
||||
result: InlineQueryResult
|
||||
) = execute(AnswerWebAppQuery(webAppQueryId, result))
|
@ -0,0 +1,21 @@
|
||||
package dev.inmo.tgbotapi.requests.answers
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult
|
||||
import dev.inmo.tgbotapi.types.webapps.query.SentWebAppMessage
|
||||
import kotlinx.serialization.*
|
||||
|
||||
@Serializable
|
||||
data class AnswerWebAppQuery(
|
||||
@SerialName(webAppQueryIdField)
|
||||
val webAppQueryId: WebAppQueryId,
|
||||
@SerialName(resultField)
|
||||
val result: InlineQueryResult
|
||||
) : SimpleRequest<SentWebAppMessage> {
|
||||
override fun method(): String = "answerWebAppQuery"
|
||||
override val resultDeserializer: DeserializationStrategy<SentWebAppMessage>
|
||||
get() = SentWebAppMessage.serializer()
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
@ -27,6 +27,7 @@ typealias FoursquareType = String
|
||||
typealias GooglePlaceId = String
|
||||
typealias GooglePlaceType = String
|
||||
typealias MembersLimit = Int
|
||||
typealias WebAppQueryId = String
|
||||
|
||||
typealias Seconds = Int
|
||||
typealias MilliSeconds = Long
|
||||
@ -133,6 +134,7 @@ const val inlineMessageIdField = "inline_message_id"
|
||||
const val callbackDataField = "callback_data"
|
||||
const val callbackGameField = "callback_game"
|
||||
const val callbackQueryIdField = "callback_query_id"
|
||||
const val webAppQueryIdField = "web_app_query_id"
|
||||
const val inlineQueryIdField = "inline_query_id"
|
||||
const val inlineKeyboardField = "inline_keyboard"
|
||||
const val showAlertField = "show_alert"
|
||||
@ -324,6 +326,7 @@ const val pricesField = "prices"
|
||||
const val payloadField = "payload"
|
||||
const val vcardField = "vcard"
|
||||
const val resultsField = "results"
|
||||
const val resultField = "result"
|
||||
const val certificateField = "certificate"
|
||||
const val questionField = "question"
|
||||
const val optionsField = "options"
|
||||
|
@ -0,0 +1,9 @@
|
||||
package dev.inmo.tgbotapi.types.webapps.query
|
||||
|
||||
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class SentWebAppMessage(
|
||||
val inlineMessageId: InlineMessageIdentifier? = null
|
||||
)
|
Loading…
Reference in New Issue
Block a user