mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-09 09:53:47 +00:00
moving to an explicit API mode
refactored `files` package
This commit is contained in:
parent
6fa0ca3b89
commit
52f17178ab
@ -8,31 +8,31 @@ import dev.inmo.tgbotapi.types.files.PathedFile
|
|||||||
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
||||||
import dev.inmo.tgbotapi.types.message.content.MediaContent
|
import dev.inmo.tgbotapi.types.message.content.MediaContent
|
||||||
|
|
||||||
suspend fun TelegramBot.downloadFile(
|
public suspend fun TelegramBot.downloadFile(
|
||||||
filePath: String
|
filePath: String
|
||||||
): ByteArray = execute(
|
): ByteArray = execute(
|
||||||
DownloadFile(filePath)
|
DownloadFile(filePath)
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.downloadFile(
|
public suspend fun TelegramBot.downloadFile(
|
||||||
pathedFile: PathedFile
|
pathedFile: PathedFile
|
||||||
): ByteArray = downloadFile(
|
): ByteArray = downloadFile(
|
||||||
pathedFile.filePath
|
pathedFile.filePath
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.downloadFile(
|
public suspend fun TelegramBot.downloadFile(
|
||||||
fileId: FileId
|
fileId: FileId
|
||||||
): ByteArray = downloadFile(
|
): ByteArray = downloadFile(
|
||||||
getFileAdditionalInfo(fileId)
|
getFileAdditionalInfo(fileId)
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.downloadFile(
|
public suspend fun TelegramBot.downloadFile(
|
||||||
file: TelegramMediaFile
|
file: TelegramMediaFile
|
||||||
): ByteArray = downloadFile(
|
): ByteArray = downloadFile(
|
||||||
getFileAdditionalInfo(file)
|
getFileAdditionalInfo(file)
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.downloadFile(
|
public suspend fun TelegramBot.downloadFile(
|
||||||
file: MediaContent
|
file: MediaContent
|
||||||
): ByteArray = downloadFile(
|
): ByteArray = downloadFile(
|
||||||
getFileAdditionalInfo(file.media)
|
getFileAdditionalInfo(file.media)
|
||||||
|
@ -6,23 +6,24 @@ import dev.inmo.tgbotapi.requests.abstracts.FileId
|
|||||||
import dev.inmo.tgbotapi.types.files.PathedFile
|
import dev.inmo.tgbotapi.types.files.PathedFile
|
||||||
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
||||||
import dev.inmo.tgbotapi.types.message.content.MediaContent
|
import dev.inmo.tgbotapi.types.message.content.MediaContent
|
||||||
|
import io.ktor.utils.io.*
|
||||||
|
|
||||||
suspend fun TelegramBot.downloadFileStream(
|
public suspend fun TelegramBot.downloadFileStream(
|
||||||
filePath: String
|
filePath: String
|
||||||
) = downloadFileStreamAllocator(filePath).invoke()
|
): ByteReadChannel = downloadFileStreamAllocator(filePath).invoke()
|
||||||
|
|
||||||
suspend fun TelegramBot.downloadFileStream(
|
public suspend fun TelegramBot.downloadFileStream(
|
||||||
pathedFile: PathedFile
|
pathedFile: PathedFile
|
||||||
) = downloadFileStream(pathedFile.filePath)
|
): ByteReadChannel = downloadFileStream(pathedFile.filePath)
|
||||||
|
|
||||||
suspend fun TelegramBot.downloadFileStream(
|
public suspend fun TelegramBot.downloadFileStream(
|
||||||
fileId: FileId
|
fileId: FileId
|
||||||
) = downloadFileStream(getFileAdditionalInfo(fileId))
|
): ByteReadChannel = downloadFileStream(getFileAdditionalInfo(fileId))
|
||||||
|
|
||||||
suspend fun TelegramBot.downloadFileStream(
|
public suspend fun TelegramBot.downloadFileStream(
|
||||||
file: TelegramMediaFile
|
file: TelegramMediaFile
|
||||||
) = downloadFileStream(getFileAdditionalInfo(file))
|
): ByteReadChannel = downloadFileStream(getFileAdditionalInfo(file))
|
||||||
|
|
||||||
suspend fun TelegramBot.downloadFileStream(
|
public suspend fun TelegramBot.downloadFileStream(
|
||||||
file: MediaContent
|
file: MediaContent
|
||||||
) = downloadFileStream(getFileAdditionalInfo(file.media))
|
): ByteReadChannel = downloadFileStream(getFileAdditionalInfo(file.media))
|
||||||
|
@ -7,23 +7,24 @@ import dev.inmo.tgbotapi.requests.abstracts.FileId
|
|||||||
import dev.inmo.tgbotapi.types.files.PathedFile
|
import dev.inmo.tgbotapi.types.files.PathedFile
|
||||||
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
||||||
import dev.inmo.tgbotapi.types.message.content.MediaContent
|
import dev.inmo.tgbotapi.types.message.content.MediaContent
|
||||||
|
import dev.inmo.tgbotapi.utils.ByteReadChannelAllocator
|
||||||
|
|
||||||
suspend fun TelegramBot.downloadFileStreamAllocator(
|
public suspend fun TelegramBot.downloadFileStreamAllocator(
|
||||||
filePath: String
|
filePath: String
|
||||||
) = execute(DownloadFileStream(filePath))
|
): ByteReadChannelAllocator = execute(DownloadFileStream(filePath))
|
||||||
|
|
||||||
suspend fun TelegramBot.downloadFileStreamAllocator(
|
public suspend fun TelegramBot.downloadFileStreamAllocator(
|
||||||
pathedFile: PathedFile
|
pathedFile: PathedFile
|
||||||
) = downloadFileStreamAllocator(pathedFile.filePath)
|
): ByteReadChannelAllocator = downloadFileStreamAllocator(pathedFile.filePath)
|
||||||
|
|
||||||
suspend fun TelegramBot.downloadFileStreamAllocator(
|
public suspend fun TelegramBot.downloadFileStreamAllocator(
|
||||||
fileId: FileId
|
fileId: FileId
|
||||||
) = downloadFileStreamAllocator(getFileAdditionalInfo(fileId))
|
): ByteReadChannelAllocator = downloadFileStreamAllocator(getFileAdditionalInfo(fileId))
|
||||||
|
|
||||||
suspend fun TelegramBot.downloadFileStreamAllocator(
|
public suspend fun TelegramBot.downloadFileStreamAllocator(
|
||||||
file: TelegramMediaFile
|
file: TelegramMediaFile
|
||||||
) = downloadFileStreamAllocator(getFileAdditionalInfo(file))
|
): ByteReadChannelAllocator = downloadFileStreamAllocator(getFileAdditionalInfo(file))
|
||||||
|
|
||||||
suspend fun TelegramBot.downloadFileStreamAllocator(
|
public suspend fun TelegramBot.downloadFileStreamAllocator(
|
||||||
file: MediaContent
|
file: MediaContent
|
||||||
) = downloadFileStreamAllocator(getFileAdditionalInfo(file.media))
|
): ByteReadChannelAllocator = downloadFileStreamAllocator(getFileAdditionalInfo(file.media))
|
||||||
|
Loading…
Reference in New Issue
Block a user