mirror of
https://github.com/flibusta-apps/telegram_files_cache_server.git
synced 2025-12-06 14:45:36 +01:00
Fix
This commit is contained in:
@@ -72,9 +72,7 @@ async def check_books(ctx: dict, *args, **kwargs) -> None: # NOSONAR
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def cache_file(
|
async def cache_file(book: Book, file_type: str) -> Optional[CachedFile]:
|
||||||
book: Book, file_type: str, by_request: bool = True
|
|
||||||
) -> Optional[CachedFile]:
|
|
||||||
if await CachedFile.objects.filter(
|
if await CachedFile.objects.filter(
|
||||||
object_id=book.id, object_type=file_type
|
object_id=book.id, object_type=file_type
|
||||||
).exists():
|
).exists():
|
||||||
@@ -108,15 +106,13 @@ async def cache_file(
|
|||||||
if upload_data is None:
|
if upload_data is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
cached_file = await CachedFile.objects.create(
|
return await CachedFile.objects.create(
|
||||||
object_id=book.id,
|
object_id=book.id,
|
||||||
object_type=file_type,
|
object_type=file_type,
|
||||||
message_id=upload_data.data["message_id"],
|
message_id=upload_data.data["message_id"],
|
||||||
chat_id=upload_data.data["chat_id"],
|
chat_id=upload_data.data["chat_id"],
|
||||||
)
|
)
|
||||||
|
|
||||||
return cached_file
|
|
||||||
|
|
||||||
|
|
||||||
async def cache_file_by_book_id(
|
async def cache_file_by_book_id(
|
||||||
ctx: dict, # NOSONAR
|
ctx: dict, # NOSONAR
|
||||||
|
|||||||
Reference in New Issue
Block a user