diff --git a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerCallbackQuery.kt b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerCallbackQuery.kt index 0f4188d3ee..0c92f280e0 100644 --- a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerCallbackQuery.kt +++ b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerCallbackQuery.kt @@ -34,7 +34,7 @@ fun CallbackQuery.createAnswer( cachedTimeSeconds: Int? = null ): AnswerCallbackQuery = AnswerCallbackQuery(id, text, showAlert, url, cachedTimeSeconds) -suspend fun RequestsExecutor.sendCallbackQueryAnswer( +suspend fun RequestsExecutor.answerCallbackQuery( callbackQueryId: CallbackQueryIdentifier, text: String? = null, showAlert: Boolean? = null, @@ -42,10 +42,10 @@ suspend fun RequestsExecutor.sendCallbackQueryAnswer( cachedTimeSeconds: Int? = null ) = execute(AnswerCallbackQuery(callbackQueryId, text, showAlert, url, cachedTimeSeconds)) -suspend fun RequestsExecutor.sendCallbackQueryAnswer( +suspend fun RequestsExecutor.answerCallbackQuery( callbackQuery: CallbackQuery, text: String? = null, showAlert: Boolean? = null, url: String? = null, cachedTimeSeconds: Int? = null -) = sendCallbackQueryAnswer(callbackQuery.id, text, showAlert, url, cachedTimeSeconds) +) = answerCallbackQuery(callbackQuery.id, text, showAlert, url, cachedTimeSeconds) diff --git a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerInlineQuery.kt b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerInlineQuery.kt index c4205bfec7..6d42f8162e 100644 --- a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerInlineQuery.kt +++ b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerInlineQuery.kt @@ -52,7 +52,7 @@ fun InlineQuery.createAnswer( switchPmParameter ) -suspend fun RequestsExecutor.sendInlineQueryAnswer( +suspend fun RequestsExecutor.answerInlineQuery( inlineQueryID: InlineQueryIdentifier, results: List = emptyList(), cachedTime: Int? = null, @@ -64,7 +64,7 @@ suspend fun RequestsExecutor.sendInlineQueryAnswer( AnswerInlineQuery(inlineQueryID, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter) ) -suspend fun RequestsExecutor.sendInlineQueryAnswer( +suspend fun RequestsExecutor.answerInlineQuery( inlineQuery: InlineQuery, results: List = emptyList(), cachedTime: Int? = null, @@ -72,7 +72,7 @@ suspend fun RequestsExecutor.sendInlineQueryAnswer( nextOffset: String? = null, switchPmText: String? = null, switchPmParameter: String? = null -) = sendInlineQueryAnswer(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter) +) = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter) internal object InlineQueryAnswersResultsSerializer: KSerializer> by ArrayListSerializer( InlineQueryResultSerializer diff --git a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/AnswerPreCheckoutQuery.kt b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/AnswerPreCheckoutQuery.kt index ff7d297270..e5a9790695 100644 --- a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/AnswerPreCheckoutQuery.kt +++ b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/AnswerPreCheckoutQuery.kt @@ -1,8 +1,9 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments +import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments.abstracts.AnswerPreCheckoutQuery import com.github.insanusmokrassar.TelegramBotAPI.types.* -import com.github.insanusmokrassar.TelegramBotAPI.types.payments.PreCheckoutQuery +import com.github.insanusmokrassar.TelegramBotAPI.types.payments.* import kotlinx.serialization.* @Serializable @@ -40,3 +41,19 @@ fun PreCheckoutQuery.createAnswerError( id, error ) + +suspend fun RequestsExecutor.answerPreCheckoutQueryOk( + id: PreCheckoutQueryId +) = execute(AnswerPreCheckoutQueryOk(id)) +suspend fun RequestsExecutor.answerPreCheckoutQueryOk( + preCheckoutQuery: PreCheckoutQuery +) = answerPreCheckoutQueryOk(preCheckoutQuery.id) + +suspend fun RequestsExecutor.answerPreCheckoutQueryError( + id: PreCheckoutQueryId, + error: String +) = execute(AnswerPreCheckoutQueryError(id, error)) +suspend fun RequestsExecutor.answerPreCheckoutQueryError( + preCheckoutQuery: PreCheckoutQuery, + error: String +) = answerPreCheckoutQueryError(preCheckoutQuery.id, error) diff --git a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/AnswerShippingQuery.kt b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/AnswerShippingQuery.kt index 70d9d8626c..9f6ab3ed03 100644 --- a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/AnswerShippingQuery.kt +++ b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/AnswerShippingQuery.kt @@ -1,5 +1,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments +import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments.abstracts.AnswerShippingQuery import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.payments.ShippingOption @@ -51,3 +52,23 @@ fun ShippingQuery.createAnswerError( id, error ) + +suspend fun RequestsExecutor.answerShippingQueryOk( + id: ShippingQueryIdentifier, + shippingOptions: List +) = execute(AnswerShippingQueryOk(id, shippingOptions)) +suspend fun RequestsExecutor.answerShippingQueryOk( + shippingQuery: ShippingQuery, + shippingOptions: List +) = answerShippingQueryOk(shippingQuery.id, shippingOptions) + +suspend fun RequestsExecutor.answerShippingQueryError( + id: ShippingQueryIdentifier, + error: String +) = execute(AnswerShippingQueryError(id, error)) +suspend fun RequestsExecutor.answerShippingQueryError( + shippingQuery: ShippingQuery, + error: String +) = answerShippingQueryError(shippingQuery.id, error) + +