1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 16:23:48 +00:00

add support of SentWebAppMessage

This commit is contained in:
InsanusMokrassar 2022-04-17 20:30:18 +06:00
parent c19bccc7d1
commit 402d91f9f2
4 changed files with 49 additions and 0 deletions

View File

@ -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))

View File

@ -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()
}

View File

@ -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"
@ -317,6 +319,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"

View File

@ -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
)