From f8a312acb33142187b7bc9f561c0bb733fb89bda Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sun, 23 Feb 2020 20:23:33 +0600 Subject: [PATCH 1/3] removing of deprecations --- CHANGELOG.md | 6 + .../TelegramBotAPI/requests/DeleteMessage.kt | 23 --- .../TelegramBotAPI/requests/ForwardMessage.kt | 48 ------ .../TelegramBotAPI/requests/GetMe.kt | 3 - .../TelegramBotAPI/requests/GetUpdates.kt | 22 --- .../TelegramBotAPI/requests/LiveLocation.kt | 140 ----------------- .../TelegramBotAPI/requests/StopPoll.kt | 30 ---- .../requests/answers/AnswerCallbackQuery.kt | 18 --- .../requests/answers/AnswerInlineQuery.kt | 24 --- .../payments/AnswerPreCheckoutQuery.kt | 20 --- .../answers/payments/AnswerShippingQuery.kt | 24 --- .../requests/chat/ExportChatInviteLink.kt | 10 -- .../TelegramBotAPI/requests/chat/LeaveChat.kt | 10 -- .../requests/chat/members/KickChatMember.kt | 28 ---- .../chat/members/PromoteChatMember.kt | 110 -------------- .../requests/chat/members/UnbanChatMember.kt | 25 --- .../requests/chat/modify/DeleteChatPhoto.kt | 10 -- .../requests/chat/modify/PinChatMessage.kt | 24 --- .../requests/chat/modify/SetChatTitle.kt | 12 -- .../requests/chat/modify/UnpinChatMessage.kt | 10 -- .../chat/stickers/DeleteChatStickerSet.kt | 10 -- .../chat/stickers/SetChatStickerSet.kt | 12 -- .../EditChatMessageLiveLocation.kt | 57 ------- .../EditInlineMessageLiveLocation.kt | 18 --- .../StopChatMessageLiveLocation.kt | 25 --- .../StopInlineMessageLiveLocation.kt | 10 -- .../ReplyMarkup/EditChatMessageReplyMarkup.kt | 23 --- .../EditInlineMessageReplyMarkup.kt | 6 - .../edit/text/EditInlineMessageText.kt | 9 -- .../requests/games/GetGameHighScoresByChat.kt | 53 ------- .../GetGameHighScoresByInlineMessageId.kt | 16 -- .../requests/games/SetGameScoreByChatId.kt | 71 --------- .../games/SetGameScoreByInlineMessageId.kt | 22 --- .../requests/send/SendAction.kt | 118 --------------- .../requests/send/SendContact.kt | 52 ------- .../requests/send/SendLocation.kt | 68 --------- .../requests/send/SendMessage.kt | 57 ------- .../requests/send/games/SendGame.kt | 46 ------ .../requests/send/media/SendAudio.kt | 142 ------------------ .../requests/send/media/SendDocument.kt | 122 --------------- .../requests/send/media/SendVideoNote.kt | 134 ----------------- .../requests/stickers/CreateNewStickerSet.kt | 53 ------- .../requests/stickers/DeleteStickerFromSet.kt | 18 --- .../stickers/SetStickerPositionInSet.kt | 20 --- .../requests/stickers/UploadStickerFile.kt | 17 --- .../requests/webhook/SetWebhook.kt | 27 ---- gradle.properties | 2 +- 47 files changed, 7 insertions(+), 1798 deletions(-) delete mode 100644 TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/LiveLocation.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index 2cb520ee04..bc05215bac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # TelegramBotAPI changelog +## 0.24.0 + +* `TelegramBotAPI`: + * All suspend functions for `RequestsExecutor` was removed (due to replacement into + [TelegramBotAPI extensions project](TelegramBotAPI-extensions-api/README.md)) + ## 0.23.0 TelegramBotAPI 4.6 * `Poll` now is sealed class diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/DeleteMessage.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/DeleteMessage.kt index f6befe6c15..d5280dabae 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/DeleteMessage.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/DeleteMessage.kt @@ -23,26 +23,3 @@ data class DeleteMessage( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.deleteMessage( - chatId: ChatIdentifier, - messageId: MessageIdentifier -) = execute( - DeleteMessage(chatId, messageId) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.deleteMessage( - chat: Chat, - messageId: MessageIdentifier -) = deleteMessage(chat.id, messageId) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.deleteMessage( - message: Message -) = deleteMessage(message.chat, message.messageId) - -suspend fun Message.delete( - requestsExecutor: RequestsExecutor -) = requestsExecutor.deleteMessage(this) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/ForwardMessage.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/ForwardMessage.kt index 22e78d45ad..807c0226a8 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/ForwardMessage.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/ForwardMessage.kt @@ -31,51 +31,3 @@ data class ForwardMessage( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.forwardMessage( - fromChatId: ChatIdentifier, - toChatId: ChatIdentifier, - messageId: MessageIdentifier, - disableNotification: Boolean = false -) = execute( - ForwardMessage(fromChatId, toChatId, messageId, disableNotification) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.forwardMessage( - fromChat: Chat, - toChatId: ChatIdentifier, - messageId: MessageIdentifier, - disableNotification: Boolean = false -) = forwardMessage(fromChat.id, toChatId, messageId, disableNotification) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.forwardMessage( - fromChatId: ChatIdentifier, - toChat: Chat, - messageId: MessageIdentifier, - disableNotification: Boolean = false -) = forwardMessage(fromChatId, toChat.id, messageId, disableNotification) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.forwardMessage( - fromChat: Chat, - toChat: Chat, - messageId: MessageIdentifier, - disableNotification: Boolean = false -) = forwardMessage(fromChat.id, toChat.id, messageId, disableNotification) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.forwardMessage( - toChatId: ChatIdentifier, - message: Message, - disableNotification: Boolean = false -) = forwardMessage(message.chat, toChatId, message.messageId, disableNotification) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.forwardMessage( - toChat: Chat, - message: Message, - disableNotification: Boolean = false -) = forwardMessage(message.chat, toChat, message.messageId, disableNotification) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/GetMe.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/GetMe.kt index 5af10ee101..03c8fe5407 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/GetMe.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/GetMe.kt @@ -13,6 +13,3 @@ class GetMe : SimpleRequest { override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.getMe() = execute(GetMe()) \ No newline at end of file diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/GetUpdates.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/GetUpdates.kt index 485e3bf8a6..f08e17c78c 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/GetUpdates.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/GetUpdates.kt @@ -28,25 +28,3 @@ data class GetUpdates( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.getUpdates( - offset: UpdateIdentifier? = null, - limit: Int? = null, - timeout: Int? = null, - allowed_updates: List? = ALL_UPDATES_LIST -) = execute( - GetUpdates( - offset, limit, timeout, allowed_updates - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.getUpdates( - lastUpdate: Update, - limit: Int? = null, - timeout: Int? = null, - allowed_updates: List? = ALL_UPDATES_LIST -) = getUpdates( - lastUpdate.updateId + 1, limit, timeout, allowed_updates -) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/LiveLocation.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/LiveLocation.kt deleted file mode 100644 index 7da413e3f1..0000000000 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/LiveLocation.kt +++ /dev/null @@ -1,140 +0,0 @@ -package com.github.insanusmokrassar.TelegramBotAPI.requests - -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor -import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation.editLiveLocation -import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation.stopLiveLocation -import com.github.insanusmokrassar.TelegramBotAPI.requests.send.SendLocation -import com.github.insanusmokrassar.TelegramBotAPI.types.* -import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup -import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup -import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat -import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage -import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.LocationContent -import com.soywiz.klock.DateTime -import com.soywiz.klock.TimeSpan -import io.ktor.utils.io.core.Closeable -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.launch -import kotlin.math.ceil - -private val livePeriodDelayMillis = (livePeriodLimit.last - 60L) * 1000L -@Deprecated("Deprecated due to extracting into separated library") -class LiveLocation internal constructor( - private val requestsExecutor: RequestsExecutor, - scope: CoroutineScope, - autoCloseTimeDelay: Double, - initMessage: ContentMessage -) : Closeable { - private val doWhenClose = { - scope.launch { - requestsExecutor.stopLiveLocation(message) - } - } - private val autoCloseTime = DateTime.now() + TimeSpan(autoCloseTimeDelay) - val leftUntilCloseMillis: TimeSpan - get() = autoCloseTime - DateTime.now() - - var isClosed: Boolean = false - private set - get() = field || leftUntilCloseMillis.millisecondsLong < 0L - - private var message: ContentMessage = initMessage - val lastLocation: Location - get() = message.content.location - - suspend fun updateLocation( - location: Location, - replyMarkup: InlineKeyboardMarkup? = null - ): Location { - if (!isClosed) { - message = requestsExecutor.editLiveLocation( - message, - location, - replyMarkup - ) - return lastLocation - } else { - error("LiveLocation is closed") - } - } - - override fun close() { - if (isClosed) { - return - } - isClosed = true - doWhenClose() - } -} - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.startLiveLocation( - scope: CoroutineScope, - chatId: ChatIdentifier, - latitude: Double, - longitude: Double, - liveTimeMillis: Long = livePeriodDelayMillis, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -): LiveLocation { - val liveTimeAsDouble = liveTimeMillis.toDouble() - val locationMessage = execute( - SendLocation( - chatId, - latitude, - longitude, - ceil(liveTimeAsDouble / 1000).toLong(), - disableNotification, - replyToMessageId, - replyMarkup - ) - ) - - return LiveLocation( - this, - scope, - liveTimeAsDouble, - locationMessage - ) -} - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.startLiveLocation( - scope: CoroutineScope, - chat: Chat, - latitude: Double, - longitude: Double, - liveTimeMillis: Long = livePeriodDelayMillis, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -): LiveLocation = startLiveLocation( - scope, chat.id, latitude, longitude, liveTimeMillis, disableNotification, replyToMessageId, replyMarkup -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.startLiveLocation( - scope: CoroutineScope, - chatId: ChatId, - location: Location, - liveTimeMillis: Long = livePeriodDelayMillis, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -): LiveLocation = startLiveLocation( - scope, chatId, location.latitude, location.longitude, liveTimeMillis, disableNotification, replyToMessageId, replyMarkup -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.startLiveLocation( - scope: CoroutineScope, - chat: Chat, - location: Location, - liveTimeMillis: Long = livePeriodDelayMillis, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -): LiveLocation = startLiveLocation( - scope, chat.id, location.latitude, location.longitude, liveTimeMillis, disableNotification, replyToMessageId, replyMarkup -) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/StopPoll.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/StopPoll.kt index a087d0b423..b203433871 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/StopPoll.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/StopPoll.kt @@ -26,33 +26,3 @@ data class StopPoll( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.stopPoll( - chatId: ChatIdentifier, - messageId: MessageIdentifier, - replyMarkup: InlineKeyboardMarkup? = null -) = execute( - StopPoll(chatId, messageId, replyMarkup) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.stopPoll( - chat: Chat, - messageId: MessageIdentifier, - replyMarkup: InlineKeyboardMarkup? = null -) = stopPoll(chat.id, messageId, replyMarkup) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.stopPoll( - chatId: ChatId, - message: Message, - replyMarkup: InlineKeyboardMarkup? = null -) = stopPoll(chatId, message.messageId, replyMarkup) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.stopPoll( - chat: Chat, - message: Message, - replyMarkup: InlineKeyboardMarkup? = null -) = stopPoll(chat.id, message.messageId, replyMarkup) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerCallbackQuery.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerCallbackQuery.kt index b298c0679d..74465b9d26 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerCallbackQuery.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerCallbackQuery.kt @@ -33,21 +33,3 @@ fun CallbackQuery.createAnswer( url: String? = null, cachedTimeSeconds: Int? = null ): AnswerCallbackQuery = AnswerCallbackQuery(id, text, showAlert, url, cachedTimeSeconds) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.answerCallbackQuery( - callbackQueryId: CallbackQueryIdentifier, - text: String? = null, - showAlert: Boolean? = null, - url: String? = null, - cachedTimeSeconds: Int? = null -) = execute(AnswerCallbackQuery(callbackQueryId, text, showAlert, url, cachedTimeSeconds)) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.answerCallbackQuery( - callbackQuery: CallbackQuery, - text: String? = null, - showAlert: Boolean? = null, - url: String? = null, - cachedTimeSeconds: Int? = null -) = answerCallbackQuery(callbackQuery.id, text, showAlert, url, cachedTimeSeconds) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerInlineQuery.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerInlineQuery.kt index cc7d7cdfaa..0fb9a4097a 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerInlineQuery.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerInlineQuery.kt @@ -52,30 +52,6 @@ fun InlineQuery.createAnswer( switchPmParameter ) -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.answerInlineQuery( - inlineQueryID: InlineQueryIdentifier, - results: List = emptyList(), - cachedTime: Int? = null, - isPersonal: Boolean? = null, - nextOffset: String? = null, - switchPmText: String? = null, - switchPmParameter: String? = null -) = execute( - AnswerInlineQuery(inlineQueryID, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.answerInlineQuery( - inlineQuery: InlineQuery, - results: List = emptyList(), - cachedTime: Int? = null, - isPersonal: Boolean? = null, - nextOffset: String? = null, - switchPmText: String? = null, - switchPmParameter: String? = null -) = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter) - internal object InlineQueryAnswersResultsSerializer: KSerializer> by ArrayListSerializer( InlineQueryResultSerializer ) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/AnswerPreCheckoutQuery.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/AnswerPreCheckoutQuery.kt index 353c6d7e34..2fa9b4277c 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/AnswerPreCheckoutQuery.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/AnswerPreCheckoutQuery.kt @@ -41,23 +41,3 @@ fun PreCheckoutQuery.createAnswerError( id, error ) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.answerPreCheckoutQueryOk( - id: PreCheckoutQueryId -) = execute(AnswerPreCheckoutQueryOk(id)) -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.answerPreCheckoutQueryOk( - preCheckoutQuery: PreCheckoutQuery -) = answerPreCheckoutQueryOk(preCheckoutQuery.id) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.answerPreCheckoutQueryError( - id: PreCheckoutQueryId, - error: String -) = execute(AnswerPreCheckoutQueryError(id, error)) -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.answerPreCheckoutQueryError( - preCheckoutQuery: PreCheckoutQuery, - error: String -) = answerPreCheckoutQueryError(preCheckoutQuery.id, error) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/AnswerShippingQuery.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/AnswerShippingQuery.kt index 4d9d2c5b74..8a9c41d455 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/AnswerShippingQuery.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/AnswerShippingQuery.kt @@ -52,27 +52,3 @@ fun ShippingQuery.createAnswerError( id, error ) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.answerShippingQueryOk( - id: ShippingQueryIdentifier, - shippingOptions: List -) = execute(AnswerShippingQueryOk(id, shippingOptions)) -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.answerShippingQueryOk( - shippingQuery: ShippingQuery, - shippingOptions: List -) = answerShippingQueryOk(shippingQuery.id, shippingOptions) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.answerShippingQueryError( - id: ShippingQueryIdentifier, - error: String -) = execute(AnswerShippingQueryError(id, error)) -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.answerShippingQueryError( - shippingQuery: ShippingQuery, - error: String -) = answerShippingQueryError(shippingQuery.id, error) - - diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/ExportChatInviteLink.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/ExportChatInviteLink.kt index 8dfaa5e279..a0532da8a9 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/ExportChatInviteLink.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/ExportChatInviteLink.kt @@ -20,13 +20,3 @@ data class ExportChatInviteLink( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.exportChatInviteLink( - chatId: ChatIdentifier -) = execute(ExportChatInviteLink(chatId)) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.exportChatInviteLink( - chat: PublicChat -) = exportChatInviteLink(chat.id) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/LeaveChat.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/LeaveChat.kt index 79327a6257..956e2e4a43 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/LeaveChat.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/LeaveChat.kt @@ -20,13 +20,3 @@ data class LeaveChat( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.leaveChat( - chatId: ChatIdentifier -) = execute(LeaveChat(chatId)) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.leaveChat( - chat: PublicChat -) = leaveChat(chat.id) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/KickChatMember.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/KickChatMember.kt index a33931a40c..740a699cc7 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/KickChatMember.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/KickChatMember.kt @@ -23,31 +23,3 @@ data class KickChatMember( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.kickChatMember( - chatId: ChatIdentifier, - userId: UserId, - untilDate: TelegramDate? = null -) = execute(KickChatMember(chatId, userId, untilDate)) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.kickChatMember( - chat: PublicChat, - userId: UserId, - untilDate: TelegramDate? = null -) = kickChatMember(chat.id, userId, untilDate) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.kickChatMember( - chatId: ChatId, - user: User, - untilDate: TelegramDate? = null -) = kickChatMember(chatId, user.id, untilDate) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.kickChatMember( - chat: PublicChat, - user: User, - untilDate: TelegramDate? = null -) = kickChatMember(chat.id, user.id, untilDate) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/PromoteChatMember.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/PromoteChatMember.kt index 4e43b4260e..1e8a9eeb91 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/PromoteChatMember.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/PromoteChatMember.kt @@ -39,113 +39,3 @@ data class PromoteChatMember( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.promoteChatMember( - chatId: ChatIdentifier, - userId: UserId, - untilDate: TelegramDate? = null, - canChangeInfo: Boolean? = null, - canPostMessages: Boolean? = null, - canEditMessages: Boolean? = null, - canDeleteMessages: Boolean? = null, - canInviteUsers: Boolean? = null, - canRestrictMembers: Boolean? = null, - canPinMessages: Boolean? = null, - canPromoteMembers: Boolean? = null -) = execute( - PromoteChatMember( - chatId, - userId, - untilDate, - canChangeInfo, - canPostMessages, - canEditMessages, - canDeleteMessages, - canInviteUsers, - canRestrictMembers, - canPinMessages, - canPromoteMembers - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.promoteChatMember( - chat: PublicChat, - userId: UserId, - untilDate: TelegramDate? = null, - canChangeInfo: Boolean? = null, - canPostMessages: Boolean? = null, - canEditMessages: Boolean? = null, - canDeleteMessages: Boolean? = null, - canInviteUsers: Boolean? = null, - canRestrictMembers: Boolean? = null, - canPinMessages: Boolean? = null, - canPromoteMembers: Boolean? = null -) = promoteChatMember( - chat.id, - userId, - untilDate, - canChangeInfo, - canPostMessages, - canEditMessages, - canDeleteMessages, - canInviteUsers, - canRestrictMembers, - canPinMessages, - canPromoteMembers -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.promoteChatMember( - chatId: ChatId, - user: User, - untilDate: TelegramDate? = null, - canChangeInfo: Boolean? = null, - canPostMessages: Boolean? = null, - canEditMessages: Boolean? = null, - canDeleteMessages: Boolean? = null, - canInviteUsers: Boolean? = null, - canRestrictMembers: Boolean? = null, - canPinMessages: Boolean? = null, - canPromoteMembers: Boolean? = null -) = promoteChatMember( - chatId, - user.id, - untilDate, - canChangeInfo, - canPostMessages, - canEditMessages, - canDeleteMessages, - canInviteUsers, - canRestrictMembers, - canPinMessages, - canPromoteMembers -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.promoteChatMember( - chat: PublicChat, - user: User, - untilDate: TelegramDate? = null, - canChangeInfo: Boolean? = null, - canPostMessages: Boolean? = null, - canEditMessages: Boolean? = null, - canDeleteMessages: Boolean? = null, - canInviteUsers: Boolean? = null, - canRestrictMembers: Boolean? = null, - canPinMessages: Boolean? = null, - canPromoteMembers: Boolean? = null -) = promoteChatMember( - chat.id, - user.id, - untilDate, - canChangeInfo, - canPostMessages, - canEditMessages, - canDeleteMessages, - canInviteUsers, - canRestrictMembers, - canPinMessages, - canPromoteMembers -) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/UnbanChatMember.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/UnbanChatMember.kt index e9f1f3402f..005efe98e6 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/UnbanChatMember.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/UnbanChatMember.kt @@ -20,28 +20,3 @@ data class UnbanChatMember( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.unbanChatMember( - chatId: ChatIdentifier, - userId: UserId -) = execute(UnbanChatMember(chatId, userId)) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.unbanChatMember( - chat: PublicChat, - userId: UserId -) = unbanChatMember(chat.id, userId) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.unbanChatMember( - chatId: ChatId, - user: User -) = unbanChatMember(chatId, user.id) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.unbanChatMember( - chat: PublicChat, - user: User -) = unbanChatMember(chat.id, user.id) - diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/DeleteChatPhoto.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/DeleteChatPhoto.kt index 1638ad3fd7..c88c03cfc7 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/DeleteChatPhoto.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/DeleteChatPhoto.kt @@ -20,13 +20,3 @@ data class DeleteChatPhoto( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.deleteChatPhoto( - chatId: ChatIdentifier -) = execute(DeleteChatPhoto(chatId)) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.deleteChatPhoto( - chat: PublicChat -) = deleteChatPhoto(chat.id) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/PinChatMessage.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/PinChatMessage.kt index 7733b54308..a1d32f2209 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/PinChatMessage.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/PinChatMessage.kt @@ -24,27 +24,3 @@ data class PinChatMessage ( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.pinChatMessage( - chatId: ChatIdentifier, - messageId: MessageIdentifier, - disableNotification: Boolean = false -) = execute(PinChatMessage(chatId, messageId, disableNotification)) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.pinChatMessage( - chat: PublicChat, - messageId: MessageIdentifier, - disableNotification: Boolean = false -) = pinChatMessage(chat.id, messageId, disableNotification) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.pinChatMessage( - message: Message, - disableNotification: Boolean = false -) = if (message.chat is PublicChat) { - pinChatMessage(message.chat.id, message.messageId, disableNotification) -} else { - error("It is possible to pin messages only in non one-to-one chats") -} diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatTitle.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatTitle.kt index d0117a6686..ba86c5954b 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatTitle.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatTitle.kt @@ -27,15 +27,3 @@ data class SetChatTitle ( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.setChatTitle( - chatId: ChatIdentifier, - title: String -) = execute(SetChatTitle(chatId, title)) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.setChatTitle( - chat: PublicChat, - title: String -) = setChatTitle(chat.id, title) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/UnpinChatMessage.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/UnpinChatMessage.kt index c0cdbc7f5c..8fee87557c 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/UnpinChatMessage.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/UnpinChatMessage.kt @@ -20,13 +20,3 @@ data class UnpinChatMessage( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.unpinChatMessage( - chatId: ChatIdentifier -) = execute(UnpinChatMessage(chatId)) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.unpinChatMessage( - chat: PublicChat -) = unpinChatMessage(chat.id) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/stickers/DeleteChatStickerSet.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/stickers/DeleteChatStickerSet.kt index 1df3e03e47..bd27af1f3e 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/stickers/DeleteChatStickerSet.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/stickers/DeleteChatStickerSet.kt @@ -20,13 +20,3 @@ data class DeleteChatStickerSet( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.deleteChatStickerSet( - chatId: ChatIdentifier -) = execute(DeleteChatStickerSet(chatId)) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.deleteChatStickerSet( - chat: SupergroupChat -) = deleteChatStickerSet(chat.id) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/stickers/SetChatStickerSet.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/stickers/SetChatStickerSet.kt index 748b930a6f..4529f7c83e 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/stickers/SetChatStickerSet.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/stickers/SetChatStickerSet.kt @@ -21,15 +21,3 @@ data class SetChatStickerSet( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.setChatStickerSet( - chatId: ChatIdentifier, - stickerSetName: StickerSetName -) = execute(SetChatStickerSet(chatId, stickerSetName)) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.setChatStickerSet( - chat: SupergroupChat, - stickerSetName: StickerSetName -) = setChatStickerSet(chat.id, stickerSetName) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/EditChatMessageLiveLocation.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/EditChatMessageLiveLocation.kt index 1608304333..7bdc3ace54 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/EditChatMessageLiveLocation.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/EditChatMessageLiveLocation.kt @@ -31,60 +31,3 @@ data class EditChatMessageLiveLocation( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.editLiveLocation( - chatId: ChatIdentifier, - messageId: MessageIdentifier, - latitude: Double, - longitude: Double, - replyMarkup: InlineKeyboardMarkup? = null -) = execute( - EditChatMessageLiveLocation( - chatId, messageId, latitude, longitude, replyMarkup - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.editLiveLocation( - chat: Chat, - messageId: MessageIdentifier, - latitude: Double, - longitude: Double, - replyMarkup: InlineKeyboardMarkup? = null -) = editLiveLocation(chat.id, messageId, latitude, longitude, replyMarkup) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.editLiveLocation( - message: ContentMessage, - latitude: Double, - longitude: Double, - replyMarkup: InlineKeyboardMarkup? = null -) = editLiveLocation(message.chat, message.messageId, latitude, longitude, replyMarkup) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.editLiveLocation( - chatId: ChatIdentifier, - messageId: MessageIdentifier, - location: Location, - replyMarkup: InlineKeyboardMarkup? = null -) = execute( - EditChatMessageLiveLocation( - chatId, messageId, location.latitude, location.longitude, replyMarkup - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.editLiveLocation( - chat: Chat, - messageId: MessageIdentifier, - location: Location, - replyMarkup: InlineKeyboardMarkup? = null -) = editLiveLocation(chat.id, messageId, location.latitude, location.longitude, replyMarkup) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.editLiveLocation( - message: ContentMessage, - location: Location, - replyMarkup: InlineKeyboardMarkup? = null -) = editLiveLocation(message.chat, message.messageId, location.latitude, location.longitude, replyMarkup) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/EditInlineMessageLiveLocation.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/EditInlineMessageLiveLocation.kt index b6bbdcb261..1317b175c2 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/EditInlineMessageLiveLocation.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/EditInlineMessageLiveLocation.kt @@ -21,21 +21,3 @@ data class EditInlineMessageLiveLocation( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.editLiveLocation( - inlineMessageId: InlineMessageIdentifier, - latitude: Double, - longitude: Double, - replyMarkup: InlineKeyboardMarkup? = null -) = execute( - EditInlineMessageLiveLocation( - inlineMessageId, latitude, longitude, replyMarkup - ) -) -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.editLiveLocation( - inlineMessageId: InlineMessageIdentifier, - location: Location, - replyMarkup: InlineKeyboardMarkup? = null -) = editLiveLocation(inlineMessageId, location.latitude, location.longitude, replyMarkup) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/StopChatMessageLiveLocation.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/StopChatMessageLiveLocation.kt index 2e0c77a80f..66d0b8cc47 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/StopChatMessageLiveLocation.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/StopChatMessageLiveLocation.kt @@ -28,28 +28,3 @@ data class StopChatMessageLiveLocation( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.stopLiveLocation( - chatId: ChatIdentifier, - messageId: MessageIdentifier, - replyMarkup: InlineKeyboardMarkup? = null -) = execute( - StopChatMessageLiveLocation( - chatId, messageId, replyMarkup - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.stopLiveLocation( - chat: Chat, - messageId: MessageIdentifier, - replyMarkup: InlineKeyboardMarkup? = null -) = stopLiveLocation(chat.id, messageId, replyMarkup) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.stopLiveLocation( - message: ContentMessage, - replyMarkup: InlineKeyboardMarkup? = null -) = stopLiveLocation(message.chat, message.messageId, replyMarkup) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/StopInlineMessageLiveLocation.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/StopInlineMessageLiveLocation.kt index e1003999cd..4da75d7df7 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/StopInlineMessageLiveLocation.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/StopInlineMessageLiveLocation.kt @@ -18,13 +18,3 @@ data class StopInlineMessageLiveLocation( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.stopLiveLocation( - inlineMessageId: InlineMessageIdentifier, - replyMarkup: InlineKeyboardMarkup? = null -) = execute( - StopInlineMessageLiveLocation( - inlineMessageId, replyMarkup - ) -) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/ReplyMarkup/EditChatMessageReplyMarkup.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/ReplyMarkup/EditChatMessageReplyMarkup.kt index ebeb494fd4..044482316f 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/ReplyMarkup/EditChatMessageReplyMarkup.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/ReplyMarkup/EditChatMessageReplyMarkup.kt @@ -30,26 +30,3 @@ data class EditChatMessageReplyMarkup( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.editMessageReplyMarkup( - chatId: ChatIdentifier, - messageId: MessageIdentifier, - replyMarkup: InlineKeyboardMarkup? = null -) = execute( - EditChatMessageReplyMarkup(chatId, messageId, replyMarkup) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.editMessageReplyMarkup( - chat: Chat, - messageId: MessageIdentifier, - replyMarkup: InlineKeyboardMarkup? = null -) = editMessageReplyMarkup(chat.id, messageId, replyMarkup) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.editMessageReplyMarkup( - message: Message, - replyMarkup: InlineKeyboardMarkup? = null -) = editMessageReplyMarkup(message.chat.id, message.messageId, replyMarkup) - diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/ReplyMarkup/EditInlineMessageReplyMarkup.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/ReplyMarkup/EditInlineMessageReplyMarkup.kt index 5995a36c7e..d8c982e8a1 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/ReplyMarkup/EditInlineMessageReplyMarkup.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/ReplyMarkup/EditInlineMessageReplyMarkup.kt @@ -18,9 +18,3 @@ data class EditInlineMessageReplyMarkup( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.editMessageReplyMarkup( - inlineMessageId: InlineMessageIdentifier, - replyMarkup: InlineKeyboardMarkup? = null -) = execute(EditInlineMessageReplyMarkup(inlineMessageId, replyMarkup)) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/text/EditInlineMessageText.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/text/EditInlineMessageText.kt index 6446baff02..e749155472 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/text/EditInlineMessageText.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/text/EditInlineMessageText.kt @@ -26,12 +26,3 @@ data class EditInlineMessageText( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.editMessageText( - inlineMessageId: InlineMessageIdentifier, - text: String, - parseMode: ParseMode? = null, - disableWebPagePreview: Boolean? = null, - replyMarkup: InlineKeyboardMarkup? = null -) = execute(EditInlineMessageText(inlineMessageId, text, parseMode, disableWebPagePreview, replyMarkup)) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/GetGameHighScoresByChat.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/GetGameHighScoresByChat.kt index 26418f9c47..f76a637066 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/GetGameHighScoresByChat.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/GetGameHighScoresByChat.kt @@ -21,56 +21,3 @@ data class GetGameHighScoresByChat ( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.getGameScore( - userId: UserId, - chatId: ChatId, - messageId: MessageIdentifier -) = execute( - GetGameHighScoresByChat(userId, chatId, messageId) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.getGameScore( - user: CommonUser, - chatId: ChatId, - messageId: MessageIdentifier -) = getGameScore( - user.id, chatId, messageId -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.getGameScore( - userId: UserId, - chat: Chat, - messageId: MessageIdentifier -) = getGameScore( - userId, chat.id, messageId -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.getGameScore( - user: CommonUser, - chat: Chat, - messageId: MessageIdentifier -) = getGameScore( - user.id, chat.id, messageId -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.getGameScore( - userId: UserId, - message: ContentMessage -) = getGameScore( - userId, message.chat.id, message.messageId -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.getGameScore( - user: CommonUser, - message: ContentMessage -) = getGameScore( - user.id, message.chat.id, message.messageId -) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/GetGameHighScoresByInlineMessageId.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/GetGameHighScoresByInlineMessageId.kt index 5ad5b14f36..f6077d4b96 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/GetGameHighScoresByInlineMessageId.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/GetGameHighScoresByInlineMessageId.kt @@ -16,19 +16,3 @@ data class GetGameHighScoresByInlineMessageId ( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.getGameScore( - userId: UserId, - inlineMessageId: InlineMessageIdentifier -) = execute( - GetGameHighScoresByInlineMessageId( - userId, inlineMessageId - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.getGameScore( - user: CommonUser, - inlineMessageId: InlineMessageIdentifier -) = getGameScore(user.id, inlineMessageId) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/SetGameScoreByChatId.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/SetGameScoreByChatId.kt index e31090cb09..487875e51e 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/SetGameScoreByChatId.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/SetGameScoreByChatId.kt @@ -27,74 +27,3 @@ data class SetGameScoreByChatId ( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.setGameScore( - userId: UserId, - score: Long, - chatId: ChatId, - messageId: MessageIdentifier, - force: Boolean = false, - disableEditMessage: Boolean = false -) = execute( - SetGameScoreByChatId(userId, score, chatId, messageId, force, disableEditMessage) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.setGameScore( - user: CommonUser, - score: Long, - chatId: ChatId, - messageId: MessageIdentifier, - force: Boolean = false, - disableEditMessage: Boolean = false -) = setGameScore( - user.id, score, chatId, messageId, force, disableEditMessage -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.setGameScore( - userId: UserId, - score: Long, - chat: Chat, - messageId: MessageIdentifier, - force: Boolean = false, - disableEditMessage: Boolean = false -) = setGameScore( - userId, score, chat.id, messageId, force, disableEditMessage -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.setGameScore( - user: CommonUser, - score: Long, - chat: Chat, - messageId: MessageIdentifier, - force: Boolean = false, - disableEditMessage: Boolean = false -) = setGameScore( - user.id, score, chat.id, messageId, force, disableEditMessage -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.setGameScore( - userId: UserId, - score: Long, - message: ContentMessage, - force: Boolean = false, - disableEditMessage: Boolean = false -) = setGameScore( - userId, score, message.chat.id, message.messageId, force, disableEditMessage -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.setGameScore( - user: CommonUser, - score: Long, - message: ContentMessage, - force: Boolean = false, - disableEditMessage: Boolean = false -) = setGameScore( - user.id, score, message.chat.id, message.messageId, force, disableEditMessage -) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/SetGameScoreByInlineMessageId.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/SetGameScoreByInlineMessageId.kt index 87f74dae91..36ae744186 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/SetGameScoreByInlineMessageId.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/SetGameScoreByInlineMessageId.kt @@ -22,25 +22,3 @@ data class SetGameScoreByInlineMessageId ( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.setGameScore( - userId: UserId, - score: Long, - inlineMessageId: InlineMessageIdentifier, - force: Boolean = false, - disableEditMessage: Boolean = false -) = execute( - SetGameScoreByInlineMessageId( - userId, score, inlineMessageId, force, disableEditMessage - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.setGameScore( - user: CommonUser, - score: Long, - inlineMessageId: InlineMessageIdentifier, - force: Boolean = false, - disableEditMessage: Boolean = false -) = setGameScore(user.id, score, inlineMessageId, force, disableEditMessage) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendAction.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendAction.kt index f6b4185dc0..65fc2f4d36 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendAction.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendAction.kt @@ -24,121 +24,3 @@ data class SendAction( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendBotAction( - chatId: ChatIdentifier, - action: BotAction -) = execute( - SendAction(chatId, action) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendBotAction( - chat: Chat, - action: BotAction -) = sendBotAction(chat.id, action) - - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendActionTyping( - chatId: ChatIdentifier -) = sendBotAction(chatId, TypingAction) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendActionUploadPhoto( - chatId: ChatIdentifier -) = sendBotAction(chatId, UploadPhotoAction) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendActionRecordVideo( - chatId: ChatIdentifier -) = sendBotAction(chatId, RecordVideoAction) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendActionUploadVideo( - chatId: ChatIdentifier -) = sendBotAction(chatId, UploadVideoAction) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendActionRecordAudio( - chatId: ChatIdentifier -) = sendBotAction(chatId, RecordAudioAction) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendActionUploadAudio( - chatId: ChatIdentifier -) = sendBotAction(chatId, UploadAudioAction) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendActionUploadDocument( - chatId: ChatIdentifier -) = sendBotAction(chatId, UploadDocumentAction) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendActionFindLocation( - chatId: ChatIdentifier -) = sendBotAction(chatId, FindLocationAction) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendActionRecordVideoNote( - chatId: ChatIdentifier -) = sendBotAction(chatId, RecordVideoNoteAction) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendActionUploadVideoNote( - chatId: ChatIdentifier -) = sendBotAction(chatId, UploadVideoNoteAction) - - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendActionTyping( - chat: Chat -) = sendBotAction(chat, TypingAction) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendActionUploadPhoto( - chat: Chat -) = sendBotAction(chat, UploadPhotoAction) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendActionRecordVideo( - chat: Chat -) = sendBotAction(chat, RecordVideoAction) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendActionUploadVideo( - chat: Chat -) = sendBotAction(chat, UploadVideoAction) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendActionRecordAudio( - chat: Chat -) = sendBotAction(chat, RecordAudioAction) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendActionUploadAudio( - chat: Chat -) = sendBotAction(chat, UploadAudioAction) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendActionUploadDocument( - chat: Chat -) = sendBotAction(chat, UploadDocumentAction) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendActionFindLocation( - chat: Chat -) = sendBotAction(chat, FindLocationAction) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendActionRecordVideoNote( - chat: Chat -) = sendBotAction(chat, RecordVideoNoteAction) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendActionUploadVideoNote( - chat: Chat -) = sendBotAction(chat, UploadVideoNoteAction) - diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendContact.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendContact.kt index b98fc8f936..2829f03893 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendContact.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendContact.kt @@ -68,55 +68,3 @@ fun Contact.toRequest( replyToMessageId, replyMarkup ) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendContact( - chatId: ChatIdentifier, - phoneNumber: String, - firstName: String, - lastName: String? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendContact( - chatId, phoneNumber, firstName, lastName, disableNotification, replyToMessageId, replyMarkup - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendContact( - chatId: ChatIdentifier, - contact: Contact, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendContact( - chatId, contact, disableNotification, replyToMessageId, replyMarkup - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendContact( - chat: Chat, - phoneNumber: String, - firstName: String, - lastName: String? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendContact( - chat.id, phoneNumber, firstName, lastName, disableNotification, replyToMessageId, replyMarkup -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendContact( - chat: Chat, - contact: Contact, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendContact( - chat.id, contact, disableNotification, replyToMessageId, replyMarkup -) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendLocation.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendLocation.kt index 7367654f96..363dee4d01 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendLocation.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendLocation.kt @@ -49,71 +49,3 @@ data class SendLocation( } } } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendLocation( - chatId: ChatIdentifier, - latitude: Double, - longitude: Double, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendLocation( - chatId, - latitude, - longitude, - disableNotification = disableNotification, - replyToMessageId = replyToMessageId, - replyMarkup = replyMarkup - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendLocation( - chatId: ChatIdentifier, - location: Location, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendLocation( - chatId, - location.latitude, - location.longitude, - disableNotification, - replyToMessageId, - replyMarkup -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendLocation( - chat: Chat, - latitude: Double, - longitude: Double, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendLocation( - chat.id, - latitude, - longitude, - disableNotification, - replyToMessageId, - replyMarkup -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendLocation( - chat: Chat, - location: Location, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendLocation( - chat.id, - location.latitude, - location.longitude, - disableNotification, - replyToMessageId, - replyMarkup -) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendMessage.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendMessage.kt index 99f7c7b7b0..d1cb8dd4f4 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendMessage.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendMessage.kt @@ -49,60 +49,3 @@ data class SendTextMessage( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated( - "This declaration is deprecated due violation of common naming rules", - ReplaceWith( - "SendTextMessage" - ) -) -typealias SendMessage = SendTextMessage - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendMessage( - chatId: ChatIdentifier, - text: String, - parseMode: ParseMode? = null, - disableWebPagePreview: Boolean? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendTextMessage(chatId, text, parseMode, disableWebPagePreview, disableNotification, replyToMessageId, replyMarkup) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendTextMessage( - chatId: ChatIdentifier, - text: String, - parseMode: ParseMode? = null, - disableWebPagePreview: Boolean? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendMessage( - chatId, text, parseMode, disableWebPagePreview, disableNotification, replyToMessageId, replyMarkup -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendMessage( - chat: Chat, - text: String, - parseMode: ParseMode? = null, - disableWebPagePreview: Boolean? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendMessage(chat.id, text, parseMode, disableWebPagePreview, disableNotification, replyToMessageId, replyMarkup) - - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendTextMessage( - chat: Chat, - text: String, - parseMode: ParseMode? = null, - disableWebPagePreview: Boolean? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendTextMessage(chat.id, text, parseMode, disableWebPagePreview, disableNotification, replyToMessageId, replyMarkup) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/games/SendGame.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/games/SendGame.kt index bf06621d67..099df2f01c 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/games/SendGame.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/games/SendGame.kt @@ -35,49 +35,3 @@ data class SendGame ( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendGame( - chatId: ChatIdentifier, - gameShortName: String, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendGame( - chatId, gameShortName, disableNotification, replyToMessageId, replyMarkup - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendGame( - chat: Chat, - gameShortName: String, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendGame( - chat.id, gameShortName, disableNotification, replyToMessageId, replyMarkup -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendGame( - chatId: ChatIdentifier, - game: Game, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendGame( - chatId, game.title, disableNotification, replyToMessageId, replyMarkup -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendGame( - chat: Chat, - game: Game, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendGame( - chat.id, game.title, disableNotification, replyToMessageId, replyMarkup -) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendAudio.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendAudio.kt index 030377b127..08bfc93bc1 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendAudio.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendAudio.kt @@ -117,145 +117,3 @@ data class SendAudioFiles internal constructor( audioField to audio, thumbField to thumb ) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendAudio( - chatId: ChatIdentifier, - audio: FileId, - thumb: FileId? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - performer: String? = null, - title: String? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendAudioData( - chatId, - audio.fileId, - thumb ?.fileId, - text, - parseMode, - duration, - performer, - title, - disableNotification, - replyToMessageId, - replyMarkup - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendAudio( - chatId: ChatIdentifier, - audio: AudioFile, - thumb: PhotoSize? = audio.thumb, - text: String? = null, - parseMode: ParseMode? = null, - title: String? = audio.title, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendAudio( - chatId, audio.fileId, thumb ?.fileId, text, parseMode, audio.duration, audio.performer, title, disableNotification, replyToMessageId, replyMarkup -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendAudio( - chatId: ChatIdentifier, - audio: MultipartFile, - thumb: FileId? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - performer: String? = null, - title: String? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - MultipartRequestImpl( - SendAudioData( - chatId, null, thumb ?.fileId, text, parseMode, duration, performer, title, disableNotification, replyToMessageId, replyMarkup - ), - SendAudioFiles(audio) - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendAudio( - chatId: ChatIdentifier, - audio: MultipartFile, - thumb: MultipartFile? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - performer: String? = null, - title: String? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - MultipartRequestImpl( - SendAudioData( - chatId, null, null, text, parseMode, duration, performer, title, disableNotification, replyToMessageId, replyMarkup - ), - SendAudioFiles(audio, thumb) - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendAudio( - chatId: ChatIdentifier, - audio: FileId, - thumb: MultipartFile, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - performer: String? = null, - title: String? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - MultipartRequestImpl( - SendAudioData( - chatId, audio.fileId, null, text, parseMode, duration, performer, title, disableNotification, replyToMessageId, replyMarkup - ), - SendAudioFiles(null, thumb) - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendAudio( - chatId: ChatIdentifier, - audio: MultipartFile, - thumb: PhotoSize? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - performer: String? = null, - title: String? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendAudio( - chatId, audio, thumb ?.fileId , text, parseMode, duration, performer, title, disableNotification, replyToMessageId, replyMarkup -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendAudio( - chatId: ChatIdentifier, - audio: AudioFile, - thumb: MultipartFile, - text: String? = null, - parseMode: ParseMode? = null, - title: String? = audio.title, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendAudio( - chatId, audio.fileId, thumb, text, parseMode, audio.duration, audio.performer, title, disableNotification, replyToMessageId, replyMarkup -) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendDocument.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendDocument.kt index 78e11e7167..144ba864f5 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendDocument.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendDocument.kt @@ -101,125 +101,3 @@ data class SendDocumentFiles internal constructor( documentField to document, thumbField to thumb ) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendDocument( - chatId: ChatIdentifier, - document: FileId, - thumb: FileId? = null, - text: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendDocumentData( - chatId, - document.fileId, - thumb ?.fileId, - text, - parseMode, - disableNotification, - replyToMessageId, - replyMarkup - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendDocument( - chatId: ChatIdentifier, - document: DocumentFile, - thumb: PhotoSize? = document.thumb, - text: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendDocument( - chatId, document.fileId, thumb ?.fileId, text, parseMode, disableNotification, replyToMessageId, replyMarkup -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendDocument( - chatId: ChatIdentifier, - document: MultipartFile, - thumb: FileId? = null, - text: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - MultipartRequestImpl( - SendDocumentData( - chatId, null, thumb ?.fileId, text, parseMode, disableNotification, replyToMessageId, replyMarkup - ), - SendDocumentFiles(document) - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendDocument( - chatId: ChatIdentifier, - document: MultipartFile, - thumb: MultipartFile? = null, - text: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - MultipartRequestImpl( - SendDocumentData( - chatId, null, null, text, parseMode, disableNotification, replyToMessageId, replyMarkup - ), - SendDocumentFiles(document, thumb) - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendDocument( - chatId: ChatIdentifier, - document: FileId, - thumb: MultipartFile, - text: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - MultipartRequestImpl( - SendDocumentData( - chatId, document.fileId, null, text, parseMode, disableNotification, replyToMessageId, replyMarkup - ), - SendDocumentFiles(null, thumb) - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendDocument( - chatId: ChatIdentifier, - document: MultipartFile, - thumb: PhotoSize? = null, - text: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendDocument( - chatId, document, thumb ?.fileId , text, parseMode, disableNotification, replyToMessageId, replyMarkup -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendDocument( - chatId: ChatIdentifier, - document: DocumentFile, - thumb: MultipartFile, - text: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendDocument( - chatId, document.fileId, thumb, text, parseMode, disableNotification, replyToMessageId, replyMarkup -) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVideoNote.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVideoNote.kt index 6f711dba41..ca57bfbfc8 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVideoNote.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVideoNote.kt @@ -114,137 +114,3 @@ data class SendVideoNoteFiles internal constructor( videoNoteField to videoNote, thumbField to thumb ) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendVideoNote( - chatId: ChatIdentifier, - videoNote: FileId, - thumb: FileId? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - size: Int? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendVideoNoteData( - chatId, - videoNote.fileId, - thumb ?.fileId, - text, - parseMode, - duration, - size, - disableNotification, - replyToMessageId, - replyMarkup - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendVideoNote( - chatId: ChatIdentifier, - videoNote: VideoFile, - thumb: PhotoSize? = videoNote.thumb, - text: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendVideoNote( - chatId, videoNote.fileId, thumb ?.fileId, text, parseMode, videoNote.duration, videoNote.width, disableNotification, replyToMessageId, replyMarkup -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendVideoNote( - chatId: ChatIdentifier, - videoNote: MultipartFile, - thumb: FileId? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - size: Int? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - MultipartRequestImpl( - SendVideoNoteData( - chatId, null, thumb ?.fileId, text, parseMode, duration, size, disableNotification, replyToMessageId, replyMarkup - ), - SendVideoNoteFiles(videoNote) - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendVideoNote( - chatId: ChatIdentifier, - videoNote: MultipartFile, - thumb: MultipartFile? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - size: Int? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - MultipartRequestImpl( - SendVideoNoteData( - chatId, null, null, text, parseMode, duration, size, disableNotification, replyToMessageId, replyMarkup - ), - SendVideoNoteFiles(videoNote, thumb) - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendVideoNote( - chatId: ChatIdentifier, - videoNote: FileId, - thumb: MultipartFile, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - size: Int? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - MultipartRequestImpl( - SendVideoNoteData( - chatId, videoNote.fileId, null, text, parseMode, duration, size, disableNotification, replyToMessageId, replyMarkup - ), - SendVideoNoteFiles(null, thumb) - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendVideoNote( - chatId: ChatIdentifier, - videoNote: MultipartFile, - thumb: PhotoSize? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - size: Int? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendVideoNote( - chatId, videoNote, thumb ?.fileId , text, parseMode, duration, size, disableNotification, replyToMessageId, replyMarkup -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.sendVideoNote( - chatId: ChatIdentifier, - videoNote: VideoFile, - thumb: MultipartFile, - text: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendVideoNote( - chatId, videoNote.fileId, thumb, text, parseMode, videoNote.duration, videoNote.width, disableNotification, replyToMessageId, replyMarkup -) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/CreateNewStickerSet.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/CreateNewStickerSet.kt index dc808522b7..2cd93d0f94 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/CreateNewStickerSet.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/CreateNewStickerSet.kt @@ -52,56 +52,3 @@ data class CreateNewStickerSet internal constructor( override fun method(): String = "createNewStickerSet" } - - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.createNewStickerSet( - userId: UserId, - name: String, - sticker: FileId, - emojis: String, - containsMasks: Boolean? = null, - maskPosition: MaskPosition? = null -) = execute( - CreateNewStickerSet(userId, name, emojis, sticker, containsMasks, maskPosition) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.createNewStickerSet( - userId: UserId, - name: String, - sticker: MultipartFile, - emojis: String, - containsMasks: Boolean? = null, - maskPosition: MaskPosition? = null -) = execute( - CommonMultipartFileRequest( - CreateNewStickerSet(userId, name, emojis, null, containsMasks, maskPosition), - mapOf(pngStickerField to sticker) - ) -) - - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.createNewStickerSet( - user: CommonUser, - name: String, - sticker: FileId, - emojis: String, - containsMasks: Boolean? = null, - maskPosition: MaskPosition? = null -) = createNewStickerSet( - user.id, name, sticker, emojis, containsMasks, maskPosition -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.createNewStickerSet( - user: CommonUser, - name: String, - sticker: MultipartFile, - emojis: String, - containsMasks: Boolean? = null, - maskPosition: MaskPosition? = null -) = createNewStickerSet( - user.id, name, sticker, emojis, containsMasks, maskPosition -) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/DeleteStickerFromSet.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/DeleteStickerFromSet.kt index ce667ab7e7..46e52b243b 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/DeleteStickerFromSet.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/DeleteStickerFromSet.kt @@ -19,21 +19,3 @@ data class DeleteStickerFromSet( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - - - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.deleteStickerFromSet( - sticker: FileId -) = execute( - DeleteStickerFromSet( - sticker - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.deleteStickerFromSet( - sticker: Sticker -) = deleteStickerFromSet( - sticker.fileId -) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/SetStickerPositionInSet.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/SetStickerPositionInSet.kt index 5f6e5f3890..fb71206675 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/SetStickerPositionInSet.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/SetStickerPositionInSet.kt @@ -28,23 +28,3 @@ data class SetStickerPositionInSet( override val requestSerializer: SerializationStrategy<*> get() = serializer() } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.setStickerPositionInSet( - sticker: FileId, - position: Int -) = execute( - SetStickerPositionInSet( - sticker, - position - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.setStickerPositionInSet( - sticker: Sticker, - position: Int -) = setStickerPositionInSet( - sticker.fileId, - position -) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/UploadStickerFile.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/UploadStickerFile.kt index 68c39c8a9d..0fa1d1307c 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/UploadStickerFile.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/UploadStickerFile.kt @@ -28,20 +28,3 @@ data class UploadStickerFile( override val resultDeserializer: DeserializationStrategy get() = File.serializer() } - - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.uploadStickerFile( - userId: UserId, - sticker: MultipartFile -) = execute( - UploadStickerFile(userId, sticker) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.uploadStickerFile( - user: CommonUser, - sticker: MultipartFile -) = execute( - UploadStickerFile(user.id, sticker) -) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/SetWebhook.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/SetWebhook.kt index 71fe700ae8..305611f57a 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/SetWebhook.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/SetWebhook.kt @@ -65,30 +65,3 @@ data class SetWebhook internal constructor( } } } - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.setWebhookInfo( - url: String, - certificate: FileId, - maxAllowedConnections: Int? = null, - allowedUpdates: List? = null -) = execute( - SetWebhook( - url, certificate.fileId, maxAllowedConnections, allowedUpdates - ) -) - -@Deprecated("Deprecated due to extracting into separated library") -suspend fun RequestsExecutor.setWebhookInfo( - url: String, - certificate: MultipartFile, - maxAllowedConnections: Int? = null, - allowedUpdates: List? = null -) = execute( - MultipartRequestImpl( - SetWebhook( - url, null, maxAllowedConnections, allowedUpdates - ), - mapOf(certificateField to certificate) - ) -) diff --git a/gradle.properties b/gradle.properties index 6b9d3c8bdc..81b7b3c264 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,6 +7,6 @@ uuid_version=0.0.7 ktor_version=1.3.1 library_group=com.github.insanusmokrassar -library_version=0.23.3 +library_version=0.24.0 gradle_bintray_plugin_version=1.8.4 From 54e3c439992e03b4680678b1b69d6ac3c10da5da Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sun, 23 Feb 2020 21:29:31 +0600 Subject: [PATCH 2/3] Most part of sending media messages functions was removed and replaced with their InputFile args analogs --- CHANGELOG.md | 3 + .../api/send/media/SendAnimation.kt | 120 +---------------- .../extensions/api/send/media/SendAudio.kt | 124 +----------------- .../extensions/api/send/media/SendDocument.kt | 102 +------------- .../extensions/api/send/media/SendPhoto.kt | 109 +-------------- .../extensions/api/send/media/SendSticker.kt | 50 +------ .../extensions/api/send/media/SendVideo.kt | 91 +------------ .../api/send/media/SendVideoNote.kt | 116 +--------------- .../extensions/api/send/media/SendVoice.kt | 110 +--------------- 9 files changed, 31 insertions(+), 794 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc05215bac..eded29891c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ * `TelegramBotAPI`: * All suspend functions for `RequestsExecutor` was removed (due to replacement into [TelegramBotAPI extensions project](TelegramBotAPI-extensions-api/README.md)) +* `TelegramBotAPI-extensions-api`: + * Most part of sending media messages functions was removed and replaced with their `InputFile` args analogs + ## 0.23.0 TelegramBotAPI 4.6 diff --git a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendAnimation.kt b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendAnimation.kt index c7ee2df51b..26aabea908 100644 --- a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendAnimation.kt +++ b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendAnimation.kt @@ -1,8 +1,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor -import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId -import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile +import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendAnimation import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier @@ -13,8 +12,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize suspend fun RequestsExecutor.sendAnimation( chatId: ChatIdentifier, - animation: FileId, - thumb: FileId? = null, + animation: InputFile, + thumb: InputFile? = null, text: String? = null, parseMode: ParseMode? = null, duration: Long? = null, @@ -42,104 +41,6 @@ suspend fun RequestsExecutor.sendAnimation( suspend fun RequestsExecutor.sendAnimation( chatId: ChatIdentifier, animation: AnimationFile, - thumb: PhotoSize? = animation.thumb, - text: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendAnimation( - chatId, animation.fileId, thumb ?.fileId, text, parseMode, animation.duration, animation.width, animation.height, disableNotification, replyToMessageId, replyMarkup -) - -suspend fun RequestsExecutor.sendAnimation( - chatId: ChatIdentifier, - animation: MultipartFile, - thumb: FileId? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - width: Int? = null, - height: Int? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendAnimation( - chatId, - animation, - thumb, - text, - parseMode, - duration, - width, - height, - disableNotification, - replyToMessageId, - replyMarkup - ) -) - -suspend fun RequestsExecutor.sendAnimation( - chatId: ChatIdentifier, - animation: MultipartFile, - thumb: MultipartFile? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - width: Int? = null, - height: Int? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendAnimation( - chatId, - animation, - thumb, - text, - parseMode, - duration, - width, - height, - disableNotification, - replyToMessageId, - replyMarkup - ) -) - -suspend fun RequestsExecutor.sendAnimation( - chatId: ChatIdentifier, - animation: FileId, - thumb: MultipartFile, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - width: Int? = null, - height: Int? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendAnimation( - chatId, - animation, - thumb, - text, - parseMode, - duration, - width, - height, - disableNotification, - replyToMessageId, - replyMarkup - ) -) - -suspend fun RequestsExecutor.sendAnimation( - chatId: ChatIdentifier, - animation: MultipartFile, - thumb: PhotoSize? = null, text: String? = null, parseMode: ParseMode? = null, duration: Long? = null, @@ -149,19 +50,6 @@ suspend fun RequestsExecutor.sendAnimation( replyToMessageId: MessageIdentifier? = null, replyMarkup: KeyboardMarkup? = null ) = sendAnimation( - chatId, animation, thumb ?.fileId , text, parseMode, duration, width, height, disableNotification, replyToMessageId, replyMarkup -) - -suspend fun RequestsExecutor.sendAnimation( - chatId: ChatIdentifier, - animation: AnimationFile, - thumb: MultipartFile, - text: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendAnimation( - chatId, animation.fileId, thumb, text, parseMode, animation.duration, animation.width, animation.height, disableNotification, replyToMessageId, replyMarkup + chatId, animation.fileId, animation.thumb ?.fileId, text, parseMode, duration, width, height, disableNotification, replyToMessageId, replyMarkup ) diff --git a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendAudio.kt b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendAudio.kt index 0951bc44f4..49c3599d3f 100644 --- a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendAudio.kt +++ b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendAudio.kt @@ -1,8 +1,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor -import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId -import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile +import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendAudio import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier @@ -13,8 +12,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize suspend fun RequestsExecutor.sendAudio( chatId: ChatIdentifier, - audio: FileId, - thumb: FileId? = null, + audio: InputFile, + thumb: InputFile? = null, text: String? = null, parseMode: ParseMode? = null, duration: Long? = null, @@ -42,7 +41,6 @@ suspend fun RequestsExecutor.sendAudio( suspend fun RequestsExecutor.sendAudio( chatId: ChatIdentifier, audio: AudioFile, - thumb: PhotoSize? = audio.thumb, text: String? = null, parseMode: ParseMode? = null, title: String? = audio.title, @@ -50,119 +48,5 @@ suspend fun RequestsExecutor.sendAudio( replyToMessageId: MessageIdentifier? = null, replyMarkup: KeyboardMarkup? = null ) = sendAudio( - chatId, audio.fileId, thumb ?.fileId, text, parseMode, audio.duration, audio.performer, title, disableNotification, replyToMessageId, replyMarkup -) - -suspend fun RequestsExecutor.sendAudio( - chatId: ChatIdentifier, - audio: MultipartFile, - thumb: FileId? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - performer: String? = null, - title: String? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendAudio( - chatId, - audio, - thumb, - text, - parseMode, - duration, - performer, - title, - disableNotification, - replyToMessageId, - replyMarkup - ) -) - -suspend fun RequestsExecutor.sendAudio( - chatId: ChatIdentifier, - audio: MultipartFile, - thumb: MultipartFile? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - performer: String? = null, - title: String? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendAudio( - chatId, - audio, - thumb, - text, - parseMode, - duration, - performer, - title, - disableNotification, - replyToMessageId, - replyMarkup - ) -) - -suspend fun RequestsExecutor.sendAudio( - chatId: ChatIdentifier, - audio: FileId, - thumb: MultipartFile, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - performer: String? = null, - title: String? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendAudio( - chatId, - audio, - thumb, - text, - parseMode, - duration, - performer, - title, - disableNotification, - replyToMessageId, - replyMarkup - ) -) - -suspend fun RequestsExecutor.sendAudio( - chatId: ChatIdentifier, - audio: MultipartFile, - thumb: PhotoSize? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - performer: String? = null, - title: String? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendAudio( - chatId, audio, thumb ?.fileId , text, parseMode, duration, performer, title, disableNotification, replyToMessageId, replyMarkup -) - -suspend fun RequestsExecutor.sendAudio( - chatId: ChatIdentifier, - audio: AudioFile, - thumb: MultipartFile, - text: String? = null, - parseMode: ParseMode? = null, - title: String? = audio.title, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendAudio( - chatId, audio.fileId, thumb, text, parseMode, audio.duration, audio.performer, title, disableNotification, replyToMessageId, replyMarkup + chatId, audio.fileId, audio.thumb ?.fileId, text, parseMode, audio.duration, audio.performer, title, disableNotification, replyToMessageId, replyMarkup ) diff --git a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendDocument.kt b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendDocument.kt index a5fe4ffb7d..a59bfcc7b0 100644 --- a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendDocument.kt +++ b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendDocument.kt @@ -1,8 +1,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor -import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId -import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile +import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendDocument import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier @@ -13,8 +12,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize suspend fun RequestsExecutor.sendDocument( chatId: ChatIdentifier, - document: FileId, - thumb: FileId? = null, + document: InputFile, + thumb: InputFile? = null, text: String? = null, parseMode: ParseMode? = null, disableNotification: Boolean = false, @@ -36,104 +35,11 @@ suspend fun RequestsExecutor.sendDocument( suspend fun RequestsExecutor.sendDocument( chatId: ChatIdentifier, document: DocumentFile, - thumb: PhotoSize? = document.thumb, text: String? = null, parseMode: ParseMode? = null, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, replyMarkup: KeyboardMarkup? = null ) = sendDocument( - chatId, document.fileId, thumb ?.fileId, text, parseMode, disableNotification, replyToMessageId, replyMarkup -) - -suspend fun RequestsExecutor.sendDocument( - chatId: ChatIdentifier, - document: MultipartFile, - thumb: FileId? = null, - text: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendDocument( - chatId, - document, - thumb, - text, - parseMode, - disableNotification, - replyToMessageId, - replyMarkup - ) -) - -suspend fun RequestsExecutor.sendDocument( - chatId: ChatIdentifier, - document: MultipartFile, - thumb: MultipartFile? = null, - text: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendDocument( - chatId, - document, - thumb, - text, - parseMode, - disableNotification, - replyToMessageId, - replyMarkup - ) -) - -suspend fun RequestsExecutor.sendDocument( - chatId: ChatIdentifier, - document: FileId, - thumb: MultipartFile, - text: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendDocument( - chatId, - document, - thumb, - text, - parseMode, - disableNotification, - replyToMessageId, - replyMarkup - ) -) - -suspend fun RequestsExecutor.sendDocument( - chatId: ChatIdentifier, - document: MultipartFile, - thumb: PhotoSize? = null, - text: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendDocument( - chatId, document, thumb ?.fileId , text, parseMode, disableNotification, replyToMessageId, replyMarkup -) - -suspend fun RequestsExecutor.sendDocument( - chatId: ChatIdentifier, - document: DocumentFile, - thumb: MultipartFile, - text: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendDocument( - chatId, document.fileId, thumb, text, parseMode, disableNotification, replyToMessageId, replyMarkup + chatId, document.fileId, document.thumb ?.fileId, text, parseMode, disableNotification, replyToMessageId, replyMarkup ) diff --git a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendPhoto.kt b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendPhoto.kt index f9460cdc9f..0d3d93311b 100644 --- a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendPhoto.kt +++ b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendPhoto.kt @@ -1,8 +1,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor -import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId -import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile +import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendPhoto import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier @@ -13,7 +12,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.files.* suspend fun RequestsExecutor.sendPhoto( chatId: ChatIdentifier, - fileId: FileId, + fileId: InputFile, caption: String? = null, parseMode: ParseMode? = null, disableNotification: Boolean = false, @@ -30,107 +29,3 @@ suspend fun RequestsExecutor.sendPhoto( replyMarkup ) ) - -suspend fun RequestsExecutor.sendPhoto( - chatId: ChatIdentifier, - photo: MultipartFile, - caption: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendPhoto( - chatId, - photo, - caption, - parseMode, - disableNotification, - replyToMessageId, - replyMarkup - ) -) - -suspend fun RequestsExecutor.sendPhoto( - chatId: ChatIdentifier, - file: PhotoSize, - caption: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendPhoto( - chatId, file.fileId, caption, parseMode, disableNotification, replyToMessageId, replyMarkup -) - -suspend fun RequestsExecutor.sendPhoto( - chatId: ChatIdentifier, - photo: Photo, - caption: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendPhoto( - chatId, photo.biggest() ?: throw IllegalArgumentException("Photo $photo is empty"), caption, parseMode, disableNotification, replyToMessageId, replyMarkup -) - -suspend fun RequestsExecutor.sendPhoto( - chat: Chat, - fileId: FileId, - caption: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendPhoto( - chat.id, - fileId, - caption, - parseMode, - disableNotification, - replyToMessageId, - replyMarkup -) - -suspend fun RequestsExecutor.sendPhoto( - chat: Chat, - file: PhotoSize, - caption: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendPhoto( - chat.id, file.fileId, caption, parseMode, disableNotification, replyToMessageId, replyMarkup -) - -suspend fun RequestsExecutor.sendPhoto( - chat: Chat, - photo: Photo, - caption: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendPhoto( - chat.id, photo.biggest() ?: throw IllegalArgumentException("Photo $photo is empty"), caption, parseMode, disableNotification, replyToMessageId, replyMarkup -) - -suspend fun RequestsExecutor.sendPhoto( - chat: Chat, - fileId: MultipartFile, - caption: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendPhoto( - chat.id, - fileId, - caption, - parseMode, - disableNotification, - replyToMessageId, - replyMarkup -) diff --git a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendSticker.kt b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendSticker.kt index bc315db06c..031c6d99bf 100644 --- a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendSticker.kt +++ b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendSticker.kt @@ -1,8 +1,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor -import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId -import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile +import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendSticker import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier @@ -12,55 +11,10 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.files.Sticker suspend fun RequestsExecutor.sendSticker( chatId: ChatIdentifier, - sticker: FileId, + sticker: InputFile, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, replyMarkup: KeyboardMarkup? = null ) = execute( SendSticker(chatId, sticker, disableNotification, replyToMessageId, replyMarkup) ) - -suspend fun RequestsExecutor.sendSticker( - chatId: ChatIdentifier, - sticker: MultipartFile, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendSticker(chatId, sticker, disableNotification, replyToMessageId, replyMarkup) -) - -suspend fun RequestsExecutor.sendSticker( - chat: Chat, - sticker: FileId, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendSticker(chat.id, sticker, disableNotification, replyToMessageId, replyMarkup) - -suspend fun RequestsExecutor.sendSticker( - chat: Chat, - sticker: MultipartFile, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendSticker(chat.id, sticker, disableNotification, replyToMessageId, replyMarkup) - -suspend fun RequestsExecutor.sendSticker( - chatId: ChatIdentifier, - sticker: Sticker, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendSticker( - chatId, sticker.fileId, disableNotification, replyToMessageId, replyMarkup -) - -suspend fun RequestsExecutor.sendSticker( - chat: Chat, - sticker: Sticker, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendSticker(chat.id, sticker.fileId, disableNotification, replyToMessageId, replyMarkup) - diff --git a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendVideo.kt b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendVideo.kt index d623c96509..dab5fb8eb9 100644 --- a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendVideo.kt +++ b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendVideo.kt @@ -1,8 +1,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor -import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId -import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile +import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendVideo import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier @@ -13,8 +12,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.files.VideoFile suspend fun RequestsExecutor.sendVideo( chatId: ChatIdentifier, - video: FileId, - thumb: FileId? = null, + video: InputFile, + thumb: InputFile? = null, text: String? = null, parseMode: ParseMode? = null, duration: Long? = null, @@ -43,93 +42,11 @@ suspend fun RequestsExecutor.sendVideo( suspend fun RequestsExecutor.sendVideo( chatId: ChatIdentifier, video: VideoFile, - thumb: PhotoSize? = video.thumb, text: String? = null, parseMode: ParseMode? = null, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, replyMarkup: KeyboardMarkup? = null ) = sendVideo( - chatId, video.fileId, thumb ?.fileId, text, parseMode, video.duration, video.width, video.height, disableNotification, replyToMessageId, replyMarkup + chatId, video.fileId, video.thumb ?.fileId, text, parseMode, video.duration, video.width, video.height, disableNotification, replyToMessageId, replyMarkup ) - -suspend fun RequestsExecutor.sendVideo( - chatId: ChatIdentifier, - video: MultipartFile, - thumb: FileId? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - width: Int? = null, - height: Int? = null, - supportStreaming: Boolean? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendVideo(chatId, video, thumb, text, parseMode, duration, width, height, supportStreaming, disableNotification, replyToMessageId, replyMarkup) -) - -suspend fun RequestsExecutor.sendVideo( - chatId: ChatIdentifier, - video: MultipartFile, - thumb: MultipartFile? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - width: Int? = null, - height: Int? = null, - supportStreaming: Boolean? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendVideo(chatId, video, thumb, text, parseMode, duration, width, height, supportStreaming, disableNotification, replyToMessageId, replyMarkup) -) - -suspend fun RequestsExecutor.sendVideo( - chatId: ChatIdentifier, - video: FileId, - thumb: MultipartFile, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - width: Int? = null, - height: Int? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendVideo(chatId, video, thumb, text, parseMode, duration, width, height, null, disableNotification, replyToMessageId, replyMarkup) -) - -suspend fun RequestsExecutor.sendVideo( - chatId: ChatIdentifier, - video: MultipartFile, - thumb: PhotoSize? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - width: Int? = null, - height: Int? = null, - supportStreaming: Boolean? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendVideo( - chatId, video, thumb ?.fileId , text, parseMode, duration, width, height, supportStreaming, disableNotification, replyToMessageId, replyMarkup -) - -suspend fun RequestsExecutor.sendVideo( - chatId: ChatIdentifier, - video: VideoFile, - thumb: MultipartFile, - text: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendVideo( - chatId, video.fileId, thumb, text, parseMode, video.duration, video.width, video.height, disableNotification, replyToMessageId, replyMarkup -) - diff --git a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendVideoNote.kt b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendVideoNote.kt index 8fc6ff6946..15c6e16a97 100644 --- a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendVideoNote.kt +++ b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendVideoNote.kt @@ -1,8 +1,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor -import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId -import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile +import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendVideoNote import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier @@ -13,8 +12,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.files.VideoFile suspend fun RequestsExecutor.sendVideoNote( chatId: ChatIdentifier, - videoNote: FileId, - thumb: FileId? = null, + videoNote: InputFile, + thumb: InputFile? = null, text: String? = null, parseMode: ParseMode? = null, duration: Long? = null, @@ -40,118 +39,11 @@ suspend fun RequestsExecutor.sendVideoNote( suspend fun RequestsExecutor.sendVideoNote( chatId: ChatIdentifier, videoNote: VideoFile, - thumb: PhotoSize? = videoNote.thumb, text: String? = null, parseMode: ParseMode? = null, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, replyMarkup: KeyboardMarkup? = null ) = sendVideoNote( - chatId, videoNote.fileId, thumb ?.fileId, text, parseMode, videoNote.duration, videoNote.width, disableNotification, replyToMessageId, replyMarkup -) - -suspend fun RequestsExecutor.sendVideoNote( - chatId: ChatIdentifier, - videoNote: MultipartFile, - thumb: FileId? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - size: Int? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendVideoNote( - chatId, - videoNote, - thumb, - text, - parseMode, - duration, - size, - disableNotification, - replyToMessageId, - replyMarkup - ) -) - -suspend fun RequestsExecutor.sendVideoNote( - chatId: ChatIdentifier, - videoNote: MultipartFile, - thumb: MultipartFile? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - size: Int? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendVideoNote( - chatId, - videoNote, - thumb, - text, - parseMode, - duration, - size, - disableNotification, - replyToMessageId, - replyMarkup - ) -) - -suspend fun RequestsExecutor.sendVideoNote( - chatId: ChatIdentifier, - videoNote: FileId, - thumb: MultipartFile, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - size: Int? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendVideoNote( - chatId, - videoNote, - thumb, - text, - parseMode, - duration, - size, - disableNotification, - replyToMessageId, - replyMarkup - ) -) - -suspend fun RequestsExecutor.sendVideoNote( - chatId: ChatIdentifier, - videoNote: MultipartFile, - thumb: PhotoSize? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - size: Int? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendVideoNote( - chatId, videoNote, thumb ?.fileId , text, parseMode, duration, size, disableNotification, replyToMessageId, replyMarkup -) - -suspend fun RequestsExecutor.sendVideoNote( - chatId: ChatIdentifier, - videoNote: VideoFile, - thumb: MultipartFile, - text: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendVideoNote( - chatId, videoNote.fileId, thumb, text, parseMode, videoNote.duration, videoNote.width, disableNotification, replyToMessageId, replyMarkup + chatId, videoNote.fileId, videoNote.thumb ?.fileId, text, parseMode, videoNote.duration, videoNote.width, disableNotification, replyToMessageId, replyMarkup ) diff --git a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendVoice.kt b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendVoice.kt index f0e233378f..c837c19128 100644 --- a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendVoice.kt +++ b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/send/media/SendVoice.kt @@ -1,8 +1,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor -import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId -import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile +import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendVoice import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier @@ -13,8 +12,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize suspend fun RequestsExecutor.sendVoice( chatId: ChatIdentifier, - voice: FileId, - thumb: FileId? = null, + voice: InputFile, + thumb: InputFile? = null, text: String? = null, parseMode: ParseMode? = null, duration: Long? = null, @@ -38,112 +37,11 @@ suspend fun RequestsExecutor.sendVoice( suspend fun RequestsExecutor.sendVoice( chatId: ChatIdentifier, voice: AudioFile, - thumb: PhotoSize? = voice.thumb, text: String? = null, parseMode: ParseMode? = null, disableNotification: Boolean = false, replyToMessageId: MessageIdentifier? = null, replyMarkup: KeyboardMarkup? = null ) = sendVoice( - chatId, voice.fileId, thumb ?.fileId, text, parseMode, voice.duration, disableNotification, replyToMessageId, replyMarkup + chatId, voice.fileId, voice.thumb ?.fileId, text, parseMode, voice.duration, disableNotification, replyToMessageId, replyMarkup ) - -suspend fun RequestsExecutor.sendVoice( - chatId: ChatIdentifier, - voice: MultipartFile, - thumb: FileId? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendVoice( - chatId, - voice, - thumb, - text, - parseMode, - duration, - disableNotification, - replyToMessageId, - replyMarkup - ) -) - -suspend fun RequestsExecutor.sendVoice( - chatId: ChatIdentifier, - voice: MultipartFile, - thumb: MultipartFile? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendVoice( - chatId, - voice, - thumb, - text, - parseMode, - duration, - disableNotification, - replyToMessageId, - replyMarkup - ) -) - -suspend fun RequestsExecutor.sendVoice( - chatId: ChatIdentifier, - voice: FileId, - thumb: MultipartFile, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = execute( - SendVoice( - chatId, - voice, - thumb, - text, - parseMode, - duration, - disableNotification, - replyToMessageId, - replyMarkup - ) -) - -suspend fun RequestsExecutor.sendVoice( - chatId: ChatIdentifier, - voice: MultipartFile, - thumb: PhotoSize? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendVoice( - chatId, voice, thumb ?.fileId , text, parseMode, duration, disableNotification, replyToMessageId, replyMarkup -) - -suspend fun RequestsExecutor.sendVoice( - chatId: ChatIdentifier, - voice: AudioFile, - thumb: MultipartFile, - text: String? = null, - parseMode: ParseMode? = null, - disableNotification: Boolean = false, - replyToMessageId: MessageIdentifier? = null, - replyMarkup: KeyboardMarkup? = null -) = sendVoice( - chatId, voice.fileId, thumb, text, parseMode, voice.duration, disableNotification, replyToMessageId, replyMarkup -) - From b22d8a5a25a595a5d8a5cba8a7f56a4e4002304f Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Tue, 25 Feb 2020 13:45:32 +0600 Subject: [PATCH 3/3] ForwardFromChannelInfo#channelChat now is ChannelChat --- CHANGELOG.md | 1 + .../TelegramBotAPI/types/message/ForwardInfo.kt | 3 ++- .../TelegramBotAPI/types/message/RawMessage.kt | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eded29891c..cc85a69bb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * `TelegramBotAPI`: * All suspend functions for `RequestsExecutor` was removed (due to replacement into [TelegramBotAPI extensions project](TelegramBotAPI-extensions-api/README.md)) + * `ForwardFromChannelInfo#channelChat` now is `ChannelChat` instead of `Chat` * `TelegramBotAPI-extensions-api`: * Most part of sending media messages functions was removed and replaced with their `InputFile` args analogs diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ForwardInfo.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ForwardInfo.kt index 662987f39a..4ca379de2e 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ForwardInfo.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ForwardInfo.kt @@ -1,6 +1,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.message import com.github.insanusmokrassar.TelegramBotAPI.types.* +import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.ChannelChat import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat @Deprecated( @@ -52,6 +53,6 @@ typealias ForwardedFromChannelMessage = ForwardFromChannelInfo data class ForwardFromChannelInfo( override val dateOfOriginal: TelegramDate, val messageId: MessageIdentifier, - val channelChat: Chat, + val channelChat: ChannelChat, val signature: String? = null ) : ForwardInfo() diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/RawMessage.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/RawMessage.kt index 6b833e32c6..b1a0cad11f 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/RawMessage.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/RawMessage.kt @@ -142,7 +142,7 @@ internal data class RawMessage( forward_date, forward_sender_name ) - forward_from_chat != null -> ForwardFromChannelInfo( + forward_from_chat is ChannelChat -> ForwardFromChannelInfo( forward_date, forward_from_message_id ?: throw IllegalStateException("Channel forwarded message must contain message id, but was not"), forward_from_chat,