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