mirror of
https://github.com/InsanusMokrassar/TelegramBotApiLibraries.git
synced 2024-12-22 16:47:16 +00:00
fixes in getting of content file cache
This commit is contained in:
parent
cde0a11c1b
commit
043948401d
@ -10,7 +10,6 @@ import dev.inmo.tgbotapi.types.InputMedia.*
|
|||||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
||||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
|
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
|
||||||
import dev.inmo.tgbotapi.utils.StorageFile
|
|
||||||
import dev.inmo.tgbotapi.utils.asInput
|
import dev.inmo.tgbotapi.utils.asInput
|
||||||
import io.ktor.utils.io.cancel
|
import io.ktor.utils.io.cancel
|
||||||
import io.ktor.utils.io.core.Input
|
import io.ktor.utils.io.core.Input
|
||||||
@ -66,20 +65,7 @@ class DefaultMessageContentCache(
|
|||||||
|
|
||||||
if (savedSimpleContent is MediaContent) {
|
if (savedSimpleContent is MediaContent) {
|
||||||
runCatching {
|
runCatching {
|
||||||
val streamAllocator = bot.execute(
|
bot.execute(GetFile(savedSimpleContent.media.fileId))
|
||||||
DownloadFileStream(
|
|
||||||
bot.execute(
|
|
||||||
GetFile(
|
|
||||||
savedSimpleContent.media.fileId
|
|
||||||
)
|
|
||||||
).filePath
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
streamAllocator().apply {
|
|
||||||
readByte()
|
|
||||||
cancel()
|
|
||||||
}
|
|
||||||
}.onFailure {
|
}.onFailure {
|
||||||
val savedFileContentAllocator = messagesFilesCache.get(chatId, messageId) ?: error("Unexpected absence of $chatId:$messageId file for content ($simpleMessageContentCache)")
|
val savedFileContentAllocator = messagesFilesCache.get(chatId, messageId) ?: error("Unexpected absence of $chatId:$messageId file for content ($simpleMessageContentCache)")
|
||||||
val newContent = bot.execute(
|
val newContent = bot.execute(
|
||||||
|
Loading…
Reference in New Issue
Block a user