mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-09-03 23:29:33 +00:00
fix of #556
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package dev.inmo.tgbotapi.extensions.utils.types.files
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.DownloadFileStream
|
||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||
import dev.inmo.tgbotapi.requests.get.GetFile
|
||||
import dev.inmo.tgbotapi.types.files.PathedFile
|
||||
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
||||
import dev.inmo.tgbotapi.utils.*
|
||||
|
||||
suspend fun multipartFile(
|
||||
downloadStreamAllocator: ByteReadChannelAllocator,
|
||||
pathedFile: PathedFile
|
||||
): MultipartFile {
|
||||
return downloadStreamAllocator.asMultipartFile(pathedFile.fileName)
|
||||
}
|
||||
|
||||
suspend fun TelegramBot.multipartFile(
|
||||
pathedFile: PathedFile
|
||||
): MultipartFile = multipartFile(
|
||||
execute(DownloadFileStream(pathedFile.filePath)),
|
||||
pathedFile
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.multipartFile(
|
||||
fileId: FileId
|
||||
): MultipartFile = multipartFile(execute(GetFile(fileId)))
|
||||
|
||||
suspend fun TelegramBot.multipartFile(
|
||||
file: TelegramMediaFile
|
||||
): MultipartFile = multipartFile(file.fileId)
|
||||
|
||||
suspend fun TelegramBot.multipartFile(
|
||||
content: MediaContent
|
||||
): MultipartFile = multipartFile(content.media)
|
@@ -9,6 +9,7 @@ import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
||||
import dev.inmo.tgbotapi.utils.*
|
||||
|
||||
@Deprecated("StorageFile now is not necessary")
|
||||
suspend fun convertToStorageFile(
|
||||
downloadStreamAllocator: ByteReadChannelAllocator,
|
||||
pathedFile: PathedFile
|
||||
@@ -18,6 +19,7 @@ suspend fun convertToStorageFile(
|
||||
)
|
||||
}
|
||||
|
||||
@Deprecated("StorageFile now is not necessary")
|
||||
suspend fun TelegramBot.convertToStorageFile(
|
||||
pathedFile: PathedFile
|
||||
): StorageFile = convertToStorageFile(
|
||||
@@ -25,14 +27,17 @@ suspend fun TelegramBot.convertToStorageFile(
|
||||
pathedFile
|
||||
)
|
||||
|
||||
@Deprecated("StorageFile now is not necessary")
|
||||
suspend fun TelegramBot.convertToStorageFile(
|
||||
fileId: FileId
|
||||
): StorageFile = convertToStorageFile(execute(GetFile(fileId)))
|
||||
|
||||
@Deprecated("StorageFile now is not necessary")
|
||||
suspend fun TelegramBot.convertToStorageFile(
|
||||
file: TelegramMediaFile
|
||||
): StorageFile = convertToStorageFile(file.fileId)
|
||||
|
||||
@Deprecated("StorageFile now is not necessary")
|
||||
suspend fun TelegramBot.convertToStorageFile(
|
||||
content: MediaContent
|
||||
): StorageFile = convertToStorageFile(content.media)
|
||||
|
Reference in New Issue
Block a user