From 65fd3ced3653d9282630b59785280f7baf298217 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 24 Jun 2021 11:21:02 +0600 Subject: [PATCH] start replacement of reply methods --- .../tgbotapi/extensions/api/send/Replies.kt | 381 ++++++++++++++++++ .../extensions/api/send/SendContact.kt | 34 -- .../tgbotapi/extensions/api/send/SendDice.kt | 16 - .../extensions/api/send/SendLocation.kt | 28 -- .../extensions/api/send/SendMessage.kt | 35 -- .../tgbotapi/extensions/api/send/SendVenue.kt | 72 ---- .../extensions/api/send/games/SendGame.kt | 24 +- .../api/send/media/SendAnimation.kt | 143 ++++--- .../extensions/api/send/media/SendAudio.kt | 105 +++-- 9 files changed, 548 insertions(+), 290 deletions(-) create mode 100644 tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/Replies.kt diff --git a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/Replies.kt b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/Replies.kt new file mode 100644 index 0000000000..51a5519478 --- /dev/null +++ b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/Replies.kt @@ -0,0 +1,381 @@ +package dev.inmo.tgbotapi.extensions.api.send + +import dev.inmo.tgbotapi.bot.TelegramBot +import dev.inmo.tgbotapi.extensions.api.send.games.sendGame +import dev.inmo.tgbotapi.extensions.api.send.media.sendAnimation +import dev.inmo.tgbotapi.extensions.api.send.media.sendAudio +import dev.inmo.tgbotapi.requests.abstracts.InputFile +import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList +import dev.inmo.tgbotapi.types.ParseMode.ParseMode +import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup +import dev.inmo.tgbotapi.types.dice.DiceAnimationType +import dev.inmo.tgbotapi.types.files.AnimationFile +import dev.inmo.tgbotapi.types.files.AudioFile +import dev.inmo.tgbotapi.types.games.Game +import dev.inmo.tgbotapi.types.location.StaticLocation +import dev.inmo.tgbotapi.types.message.abstracts.Message +import dev.inmo.tgbotapi.types.venue.Venue + + +// Contact + +suspend inline fun TelegramBot.reply( + to: Message, + phoneNumber: String, + firstName: String, + lastName: String? = null, + disableNotification: Boolean = false, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = sendContact( + to.chat, + phoneNumber, + firstName, + lastName, + disableNotification, + to.messageId, + allowSendingWithoutReply, + replyMarkup +) + +suspend inline fun TelegramBot.reply( + to: Message, + contact: Contact, + disableNotification: Boolean = false, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = sendContact( + to.chat, + contact, + disableNotification, + to.messageId, + allowSendingWithoutReply, + replyMarkup +) + + +// Dice + +suspend inline fun TelegramBot.replyWithDice( + to: Message, + animationType: DiceAnimationType? = null, + disableNotification: Boolean = false, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = sendDice(to.chat, animationType, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup) + +suspend inline fun TelegramBot.reply( + to: Message, + animationType: DiceAnimationType, + disableNotification: Boolean = false, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = replyWithDice(to, animationType, disableNotification, allowSendingWithoutReply, replyMarkup) + + +// Location + +suspend inline fun TelegramBot.reply( + to: Message, + latitude: Double, + longitude: Double, + disableNotification: Boolean = false, + replyMarkup: KeyboardMarkup? = null +) = sendLocation( + to.chat, + latitude, + longitude, + disableNotification, + to.messageId, + replyMarkup +) + +suspend inline fun TelegramBot.reply( + to: Message, + location: StaticLocation, + disableNotification: Boolean = false, + replyMarkup: KeyboardMarkup? = null +) = sendLocation( + to.chat, + location, + disableNotification, + to.messageId, + replyMarkup +) + + +// Text message + +suspend inline fun TelegramBot.reply( + to: Message, + text: String, + parseMode: ParseMode? = null, + disableWebPagePreview: Boolean? = null, + disableNotification: Boolean = false, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = sendTextMessage( + to.chat, + text, + parseMode, + disableWebPagePreview, + disableNotification, + to.messageId, + allowSendingWithoutReply, + replyMarkup +) + +suspend inline fun TelegramBot.reply( + to: Message, + entities: TextSourcesList, + disableWebPagePreview: Boolean? = null, + disableNotification: Boolean = false, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = sendTextMessage( + to.chat, + entities, + disableWebPagePreview, + disableNotification, + to.messageId, + allowSendingWithoutReply, + replyMarkup +) + + +// Venue + +suspend inline fun TelegramBot.reply( + to: Message, + latitude: Double, + longitude: Double, + title: String, + address: String, + foursquareId: FoursquareId? = null, + foursquareType: FoursquareType? = null, + googlePlaceId: GooglePlaceId? = null, + googlePlaceType: GooglePlaceType? = null, + disableNotification: Boolean = false, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = sendVenue( + chat = to.chat, + latitude = latitude, + longitude = longitude, + title = title, + address = address, + foursquareId = foursquareId, + foursquareType = foursquareType, + googlePlaceId = googlePlaceId, + googlePlaceType = googlePlaceType, + disableNotification = disableNotification, + replyToMessageId = to.messageId, + allowSendingWithoutReply = allowSendingWithoutReply, + replyMarkup = replyMarkup +) + +suspend inline fun TelegramBot.reply( + to: Message, + location: StaticLocation, + title: String, + address: String, + foursquareId: FoursquareId? = null, + foursquareType: FoursquareType? = null, + googlePlaceId: GooglePlaceId? = null, + googlePlaceType: GooglePlaceType? = null, + disableNotification: Boolean = false, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = sendVenue( + chat = to.chat, + latitude = location.latitude, + longitude = location.longitude, + title = title, + address = address, + foursquareId = foursquareId, + foursquareType = foursquareType, + googlePlaceId = googlePlaceId, + googlePlaceType = googlePlaceType, + disableNotification = disableNotification, + replyToMessageId = to.messageId, + allowSendingWithoutReply = allowSendingWithoutReply, + replyMarkup = replyMarkup +) + +suspend inline fun TelegramBot.reply( + to: Message, + venue: Venue, + disableNotification: Boolean = false, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = sendVenue( + chat = to.chat, + venue = venue, + disableNotification = disableNotification, + replyToMessageId = to.messageId, + allowSendingWithoutReply = allowSendingWithoutReply, + replyMarkup = replyMarkup +) + + +// Game + +suspend inline fun TelegramBot.replyWithGame( + to: Message, + gameShortName: String, + disableNotification: Boolean = false, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = sendGame( + to.chat, gameShortName, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup +) + +suspend inline fun TelegramBot.replyWithGame( + to: Message, + game: Game, + disableNotification: Boolean = false, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = sendGame( + to.chat, game.title, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup +) + +suspend inline fun TelegramBot.reply( + to: Message, + game: Game, + disableNotification: Boolean = false, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = replyWithGame(to, game, disableNotification, allowSendingWithoutReply, replyMarkup) + + +// Animation + +suspend inline fun TelegramBot.replyWithAnimation( + to: Message, + animation: InputFile, + thumb: InputFile? = null, + text: String? = null, + parseMode: ParseMode? = null, + duration: Long? = null, + width: Int? = null, + height: Int? = null, + disableNotification: Boolean = false, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = sendAnimation( + to.chat, + animation, + thumb, + text, + parseMode, + duration, + width, + height, + disableNotification, + to.messageId, + allowSendingWithoutReply, + replyMarkup +) + +suspend inline fun TelegramBot.reply( + to: Message, + animation: AnimationFile, + text: String? = null, + parseMode: ParseMode? = null, + duration: Long? = null, + width: Int? = null, + height: Int? = null, + disableNotification: Boolean = false, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = sendAnimation(to.chat, animation, text, parseMode, duration, width, height, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup) + +suspend inline fun TelegramBot.replyWithAnimation( + to: Message, + animation: InputFile, + entities: TextSourcesList, + thumb: InputFile? = null, + duration: Long? = null, + width: Int? = null, + height: Int? = null, + disableNotification: Boolean = false, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = sendAnimation( + to.chat, + animation, + thumb, + entities, + duration, + width, + height, + disableNotification, + to.messageId, + allowSendingWithoutReply, + replyMarkup +) + +suspend inline fun TelegramBot.reply( + to: Message, + animation: AnimationFile, + entities: TextSourcesList, + duration: Long? = null, + width: Int? = null, + height: Int? = null, + disableNotification: Boolean = false, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = sendAnimation(to.chat, animation, entities, duration, width, height, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup) + + +// Audio + +suspend inline fun TelegramBot.replyWithAudio( + to: Message, + audio: InputFile, + thumb: InputFile? = null, + text: String? = null, + parseMode: ParseMode? = null, + duration: Long? = null, + performer: String? = null, + title: String? = null, + disableNotification: Boolean = false, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = sendAudio(to.chat, audio, thumb, text, parseMode, duration, performer, title, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup) + +suspend inline fun TelegramBot.reply( + to: Message, + audio: AudioFile, + text: String? = null, + parseMode: ParseMode? = null, + title: String? = null, + disableNotification: Boolean = false, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = sendAudio(to.chat, audio, text, parseMode, title, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup) + +suspend inline fun TelegramBot.replyWithAudio( + to: Message, + audio: InputFile, + thumb: InputFile? = null, + entities: TextSourcesList, + duration: Long? = null, + performer: String? = null, + title: String? = null, + disableNotification: Boolean = false, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = sendAudio(to.chat, audio, thumb, entities, duration, performer, title, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup) + +suspend inline fun TelegramBot.reply( + to: Message, + audio: AudioFile, + entities: TextSourcesList, + title: String? = null, + disableNotification: Boolean = false, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = sendAudio(to.chat, audio, entities, title, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup) diff --git a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendContact.kt b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendContact.kt index 7edf1423e4..aeaf39f7c9 100644 --- a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendContact.kt +++ b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendContact.kt @@ -58,37 +58,3 @@ suspend fun TelegramBot.sendContact( ) = sendContact( chat.id, contact, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup ) - -suspend inline fun TelegramBot.reply( - to: Message, - phoneNumber: String, - firstName: String, - lastName: String? = null, - disableNotification: Boolean = false, - allowSendingWithoutReply: Boolean? = null, - replyMarkup: KeyboardMarkup? = null -) = sendContact( - to.chat, - phoneNumber, - firstName, - lastName, - disableNotification, - to.messageId, - allowSendingWithoutReply, - replyMarkup -) - -suspend inline fun TelegramBot.reply( - to: Message, - contact: Contact, - disableNotification: Boolean = false, - allowSendingWithoutReply: Boolean? = null, - replyMarkup: KeyboardMarkup? = null -) = sendContact( - to.chat, - contact, - disableNotification, - to.messageId, - allowSendingWithoutReply, - replyMarkup -) diff --git a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendDice.kt b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendDice.kt index ff3ee673d4..99f1349625 100644 --- a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendDice.kt +++ b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendDice.kt @@ -28,19 +28,3 @@ suspend fun TelegramBot.sendDice( allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = sendDice(chat.id, animationType, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup) - -suspend inline fun TelegramBot.replyWithDice( - to: Message, - animationType: DiceAnimationType? = null, - disableNotification: Boolean = false, - allowSendingWithoutReply: Boolean? = null, - replyMarkup: KeyboardMarkup? = null -) = sendDice(to.chat, animationType, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup) - -suspend inline fun TelegramBot.reply( - to: Message, - animationType: DiceAnimationType? = null, - disableNotification: Boolean = false, - allowSendingWithoutReply: Boolean? = null, - replyMarkup: KeyboardMarkup? = null -) = replyWithDice(to, animationType, disableNotification, allowSendingWithoutReply, replyMarkup) diff --git a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendLocation.kt b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendLocation.kt index 7a98d1b72e..d54cef6d01 100644 --- a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendLocation.kt +++ b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendLocation.kt @@ -106,31 +106,3 @@ suspend fun TelegramBot.sendStaticLocation( replyToMessageId: MessageIdentifier? = null, replyMarkup: KeyboardMarkup? = null ) = sendLocation(chat.id, location.latitude, location.longitude, disableNotification, replyToMessageId, replyMarkup) - -suspend inline fun TelegramBot.reply( - to: Message, - latitude: Double, - longitude: Double, - disableNotification: Boolean = false, - replyMarkup: KeyboardMarkup? = null -) = sendLocation( - to.chat, - latitude, - longitude, - disableNotification, - to.messageId, - replyMarkup -) - -suspend inline fun TelegramBot.reply( - to: Message, - location: StaticLocation, - disableNotification: Boolean = false, - replyMarkup: KeyboardMarkup? = null -) = sendLocation( - to.chat, - location, - disableNotification, - to.messageId, - replyMarkup -) diff --git a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendMessage.kt b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendMessage.kt index 30447010b2..6b0ac23d4b 100644 --- a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendMessage.kt +++ b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendMessage.kt @@ -103,38 +103,3 @@ suspend fun TelegramBot.sendTextMessage( allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = sendTextMessage(chat.id, entities, disableWebPagePreview, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup) - -suspend inline fun TelegramBot.reply( - to: Message, - text: String, - parseMode: ParseMode? = null, - disableWebPagePreview: Boolean? = null, - disableNotification: Boolean = false, - allowSendingWithoutReply: Boolean? = null, - replyMarkup: KeyboardMarkup? = null -) = sendTextMessage( - to.chat, - text, - parseMode, - disableWebPagePreview, - disableNotification, - to.messageId, - allowSendingWithoutReply, - replyMarkup -) -suspend inline fun TelegramBot.reply( - to: Message, - entities: TextSourcesList, - disableWebPagePreview: Boolean? = null, - disableNotification: Boolean = false, - allowSendingWithoutReply: Boolean? = null, - replyMarkup: KeyboardMarkup? = null -) = sendTextMessage( - to.chat, - entities, - disableWebPagePreview, - disableNotification, - to.messageId, - allowSendingWithoutReply, - replyMarkup -) diff --git a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendVenue.kt b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendVenue.kt index 1f444aa8c0..73674855fb 100644 --- a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendVenue.kt +++ b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendVenue.kt @@ -162,75 +162,3 @@ suspend fun TelegramBot.sendVenue( allowSendingWithoutReply = allowSendingWithoutReply, replyMarkup = replyMarkup ) - -suspend inline fun TelegramBot.reply( - to: Message, - latitude: Double, - longitude: Double, - title: String, - address: String, - foursquareId: FoursquareId? = null, - foursquareType: FoursquareType? = null, - googlePlaceId: GooglePlaceId? = null, - googlePlaceType: GooglePlaceType? = null, - disableNotification: Boolean = false, - allowSendingWithoutReply: Boolean? = null, - replyMarkup: KeyboardMarkup? = null -) = sendVenue( - chat = to.chat, - latitude = latitude, - longitude = longitude, - title = title, - address = address, - foursquareId = foursquareId, - foursquareType = foursquareType, - googlePlaceId = googlePlaceId, - googlePlaceType = googlePlaceType, - disableNotification = disableNotification, - replyToMessageId = to.messageId, - allowSendingWithoutReply = allowSendingWithoutReply, - replyMarkup = replyMarkup -) - -suspend inline fun TelegramBot.reply( - to: Message, - location: StaticLocation, - title: String, - address: String, - foursquareId: FoursquareId? = null, - foursquareType: FoursquareType? = null, - googlePlaceId: GooglePlaceId? = null, - googlePlaceType: GooglePlaceType? = null, - disableNotification: Boolean = false, - allowSendingWithoutReply: Boolean? = null, - replyMarkup: KeyboardMarkup? = null -) = sendVenue( - chat = to.chat, - latitude = location.latitude, - longitude = location.longitude, - title = title, - address = address, - foursquareId = foursquareId, - foursquareType = foursquareType, - googlePlaceId = googlePlaceId, - googlePlaceType = googlePlaceType, - disableNotification = disableNotification, - replyToMessageId = to.messageId, - allowSendingWithoutReply = allowSendingWithoutReply, - replyMarkup = replyMarkup -) - -suspend inline fun TelegramBot.reply( - to: Message, - venue: Venue, - disableNotification: Boolean = false, - allowSendingWithoutReply: Boolean? = null, - replyMarkup: KeyboardMarkup? = null -) = sendVenue( - chat = to.chat, - venue = venue, - disableNotification = disableNotification, - replyToMessageId = to.messageId, - allowSendingWithoutReply = allowSendingWithoutReply, - replyMarkup = replyMarkup -) diff --git a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/games/SendGame.kt b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/games/SendGame.kt index bc95b64ca3..3b6ba4fa26 100644 --- a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/games/SendGame.kt +++ b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/games/SendGame.kt @@ -1,6 +1,8 @@ package dev.inmo.tgbotapi.extensions.api.send.games import dev.inmo.tgbotapi.bot.TelegramBot +import dev.inmo.tgbotapi.extensions.api.send.replyWithGame +import dev.inmo.tgbotapi.extensions.api.send.reply import dev.inmo.tgbotapi.requests.send.games.SendGame import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.MessageIdentifier @@ -55,30 +57,38 @@ suspend fun TelegramBot.sendGame( chat.id, game.title, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup ) +@Deprecated( + "Replaced", + ReplaceWith("replyWithGame", "dev.inmo.tgbotapi.extensions.api.send.replyWithGame") +) suspend inline fun TelegramBot.replyWithGame( to: Message, gameShortName: String, disableNotification: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendGame( - to.chat, gameShortName, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup -) +) = replyWithGame(to, gameShortName, disableNotification, allowSendingWithoutReply, replyMarkup) +@Deprecated( + "Replaced", + ReplaceWith("replyWithGame", "dev.inmo.tgbotapi.extensions.api.send.replyWithGame") +) suspend inline fun TelegramBot.replyWithGame( to: Message, game: Game, disableNotification: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendGame( - to.chat, game.title, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup -) +) = replyWithGame(to, game, disableNotification, allowSendingWithoutReply, replyMarkup) +@Deprecated( + "Replaced", + ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply") +) suspend inline fun TelegramBot.reply( to: Message, game: Game, disableNotification: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = replyWithGame(to, game, disableNotification, allowSendingWithoutReply, replyMarkup) +) = reply(to, game, disableNotification, allowSendingWithoutReply, replyMarkup) diff --git a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendAnimation.kt b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendAnimation.kt index df6646a8b0..4690da33a3 100644 --- a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendAnimation.kt +++ b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendAnimation.kt @@ -1,6 +1,8 @@ package dev.inmo.tgbotapi.extensions.api.send.media import dev.inmo.tgbotapi.bot.TelegramBot +import dev.inmo.tgbotapi.extensions.api.send.replyWithAnimation +import dev.inmo.tgbotapi.extensions.api.send.reply import dev.inmo.tgbotapi.requests.abstracts.InputFile import dev.inmo.tgbotapi.requests.send.media.SendAnimation import dev.inmo.tgbotapi.types.ChatIdentifier @@ -87,59 +89,6 @@ suspend fun TelegramBot.sendAnimation( replyMarkup: KeyboardMarkup? = null ) = sendAnimation(chat.id, animation, text, parseMode, duration, width, height, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup) -suspend inline fun TelegramBot.replyWithAnimation( - to: Message, - animation: InputFile, - thumb: InputFile? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - width: Int? = null, - height: Int? = null, - disableNotification: Boolean = false, - allowSendingWithoutReply: Boolean? = null, - replyMarkup: KeyboardMarkup? = null -) = sendAnimation( - to.chat, - animation, - thumb, - text, - parseMode, - duration, - width, - height, - disableNotification, - to.messageId, - allowSendingWithoutReply, - replyMarkup -) - -suspend inline fun TelegramBot.replyWithAnimation( - to: Message, - animation: AnimationFile, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - width: Int? = null, - height: Int? = null, - disableNotification: Boolean = false, - allowSendingWithoutReply: Boolean? = null, - replyMarkup: KeyboardMarkup? = null -) = sendAnimation(to.chat, animation, text, parseMode, duration, width, height, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup) - -suspend inline fun TelegramBot.reply( - to: Message, - animation: AnimationFile, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - width: Int? = null, - height: Int? = null, - disableNotification: Boolean = false, - allowSendingWithoutReply: Boolean? = null, - replyMarkup: KeyboardMarkup? = null -) = replyWithAnimation(to, animation, text, parseMode, duration, width, height, disableNotification, allowSendingWithoutReply, replyMarkup) - suspend fun TelegramBot.sendAnimation( chatId: ChatIdentifier, @@ -211,6 +160,10 @@ suspend fun TelegramBot.sendAnimation( replyMarkup: KeyboardMarkup? = null ) = sendAnimation(chat.id, animation, entities, duration, width, height, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup) +@Deprecated( + "Replaced", + ReplaceWith("replyWithAnimation", "dev.inmo.tgbotapi.extensions.api.send.replyWithAnimation") +) suspend inline fun TelegramBot.replyWithAnimation( to: Message, animation: InputFile, @@ -222,20 +175,23 @@ suspend inline fun TelegramBot.replyWithAnimation( disableNotification: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendAnimation( - to.chat, +) = replyWithAnimation( + to, animation, - thumb, entities, + thumb, duration, width, height, disableNotification, - to.messageId, allowSendingWithoutReply, replyMarkup ) +@Deprecated( + "Replaced", + ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply") +) suspend inline fun TelegramBot.replyWithAnimation( to: Message, animation: AnimationFile, @@ -246,8 +202,12 @@ suspend inline fun TelegramBot.replyWithAnimation( disableNotification: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendAnimation(to.chat, animation, entities, duration, width, height, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup) +) = reply(to, animation, entities, duration, width, height, disableNotification, allowSendingWithoutReply, replyMarkup) +@Deprecated( + "Replaced", + ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply") +) suspend inline fun TelegramBot.reply( to: Message, animation: AnimationFile, @@ -258,4 +218,69 @@ suspend inline fun TelegramBot.reply( disableNotification: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = replyWithAnimation(to, animation, entities, duration, width, height, disableNotification, allowSendingWithoutReply, replyMarkup) +) = reply(to, animation, entities, duration, width, height, disableNotification, allowSendingWithoutReply, replyMarkup) + + +@Deprecated( + "Replaced", + ReplaceWith("replyWithAnimation", "dev.inmo.tgbotapi.extensions.api.send.replyWithAnimation") +) +suspend inline fun TelegramBot.replyWithAnimation( + to: Message, + animation: InputFile, + thumb: InputFile? = null, + text: String? = null, + parseMode: ParseMode? = null, + duration: Long? = null, + width: Int? = null, + height: Int? = null, + disableNotification: Boolean = false, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = replyWithAnimation( + to, + animation, + thumb, + text, + parseMode, + duration, + width, + height, + disableNotification, + allowSendingWithoutReply, + replyMarkup +) + +@Deprecated( + "Replaced", + ReplaceWith("replyWithAnimation", "dev.inmo.tgbotapi.extensions.api.send.replyWithAnimation") +) +suspend inline fun TelegramBot.replyWithAnimation( + to: Message, + animation: AnimationFile, + text: String? = null, + parseMode: ParseMode? = null, + duration: Long? = null, + width: Int? = null, + height: Int? = null, + disableNotification: Boolean = false, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = reply(to, animation, text, parseMode, duration, width, height, disableNotification, allowSendingWithoutReply, replyMarkup) + +@Deprecated( + "Replaced", + ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply") +) +suspend inline fun TelegramBot.reply( + to: Message, + animation: AnimationFile, + text: String? = null, + parseMode: ParseMode? = null, + duration: Long? = null, + width: Int? = null, + height: Int? = null, + disableNotification: Boolean = false, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = reply(to, animation, text, parseMode, duration, width, height, disableNotification, allowSendingWithoutReply, replyMarkup) diff --git a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendAudio.kt b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendAudio.kt index f19f3ea605..e3846e02f4 100644 --- a/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendAudio.kt +++ b/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/media/SendAudio.kt @@ -1,6 +1,8 @@ package dev.inmo.tgbotapi.extensions.api.send.media import dev.inmo.tgbotapi.bot.TelegramBot +import dev.inmo.tgbotapi.extensions.api.send.reply +import dev.inmo.tgbotapi.extensions.api.send.replyWithAudio import dev.inmo.tgbotapi.requests.abstracts.InputFile import dev.inmo.tgbotapi.requests.send.media.SendAudio import dev.inmo.tgbotapi.types.ChatIdentifier @@ -81,42 +83,6 @@ suspend fun TelegramBot.sendAudio( replyMarkup: KeyboardMarkup? = null ) = sendAudio(chat.id, audio, text, parseMode, title, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup) -suspend inline fun TelegramBot.replyWithAudio( - to: Message, - audio: InputFile, - thumb: InputFile? = null, - text: String? = null, - parseMode: ParseMode? = null, - duration: Long? = null, - performer: String? = null, - title: String? = null, - disableNotification: Boolean = false, - allowSendingWithoutReply: Boolean? = null, - replyMarkup: KeyboardMarkup? = null -) = sendAudio(to.chat, audio, thumb, text, parseMode, duration, performer, title, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup) - -suspend inline fun TelegramBot.replyWithAudio( - to: Message, - audio: AudioFile, - text: String? = null, - parseMode: ParseMode? = null, - title: String? = null, - disableNotification: Boolean = false, - allowSendingWithoutReply: Boolean? = null, - replyMarkup: KeyboardMarkup? = null -) = sendAudio(to.chat, audio, text, parseMode, title, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup) - -suspend inline fun TelegramBot.reply( - to: Message, - audio: AudioFile, - text: String? = null, - parseMode: ParseMode? = null, - title: String? = null, - disableNotification: Boolean = false, - allowSendingWithoutReply: Boolean? = null, - replyMarkup: KeyboardMarkup? = null -) = replyWithAudio(to, audio, text, parseMode, title, disableNotification, allowSendingWithoutReply, replyMarkup) - suspend inline fun TelegramBot.sendAudio( chatId: ChatIdentifier, @@ -182,6 +148,59 @@ suspend inline fun TelegramBot.sendAudio( replyMarkup: KeyboardMarkup? = null ) = sendAudio(chat.id, audio, entities, title, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup) + +@Deprecated( + "Replaced", + ReplaceWith("replyWithAudio", "dev.inmo.tgbotapi.extensions.api.send.replyWithAudio") +) +suspend inline fun TelegramBot.replyWithAudio( + to: Message, + audio: InputFile, + thumb: InputFile? = null, + text: String? = null, + parseMode: ParseMode? = null, + duration: Long? = null, + performer: String? = null, + title: String? = null, + disableNotification: Boolean = false, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = replyWithAudio(to, audio, thumb, text, parseMode, duration, performer, title, disableNotification, allowSendingWithoutReply, replyMarkup) + +@Deprecated( + "Replaced", + ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply") +) +suspend inline fun TelegramBot.replyWithAudio( + to: Message, + audio: AudioFile, + text: String? = null, + parseMode: ParseMode? = null, + title: String? = null, + disableNotification: Boolean = false, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = reply(to, audio, text, parseMode, title, disableNotification, allowSendingWithoutReply, replyMarkup) + +@Deprecated( + "Replaced", + ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply") +) +suspend inline fun TelegramBot.reply( + to: Message, + audio: AudioFile, + text: String? = null, + parseMode: ParseMode? = null, + title: String? = null, + disableNotification: Boolean = false, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = reply(to, audio, text, parseMode, title, disableNotification, allowSendingWithoutReply, replyMarkup) + +@Deprecated( + "Replaced", + ReplaceWith("replyWithAudio", "dev.inmo.tgbotapi.extensions.api.send.replyWithAudio") +) suspend inline fun TelegramBot.replyWithAudio( to: Message, audio: InputFile, @@ -193,8 +212,12 @@ suspend inline fun TelegramBot.replyWithAudio( disableNotification: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendAudio(to.chat, audio, thumb, entities, duration, performer, title, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup) +) = replyWithAudio(to, audio, thumb, entities, duration, performer, title, disableNotification, allowSendingWithoutReply, replyMarkup) +@Deprecated( + "Replaced", + ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.reply") +) suspend inline fun TelegramBot.replyWithAudio( to: Message, audio: AudioFile, @@ -203,8 +226,12 @@ suspend inline fun TelegramBot.replyWithAudio( disableNotification: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = sendAudio(to.chat, audio, entities, title, disableNotification, to.messageId, allowSendingWithoutReply, replyMarkup) +) = reply(to, audio, entities, title, disableNotification, allowSendingWithoutReply, replyMarkup) +@Deprecated( + "Replaced", + ReplaceWith("reply", "dev.inmo.tgbotapi.extensions.api.send.repl") +) suspend inline fun TelegramBot.reply( to: Message, audio: AudioFile, @@ -213,4 +240,4 @@ suspend inline fun TelegramBot.reply( disableNotification: Boolean = false, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -) = replyWithAudio(to, audio, entities, title, disableNotification, allowSendingWithoutReply, replyMarkup) +) = reply(to, audio, entities, title, disableNotification, allowSendingWithoutReply, replyMarkup)