Skip to content

Commit

Permalink
Update ia_filterdb.py
Browse files Browse the repository at this point in the history
  • Loading branch information
VJBots authored Dec 16, 2024
1 parent ad4da3d commit 025adc2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion database/ia_filterdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import re
import base64
import json
from datetime import datetime
from pyrogram.file_id import FileId
from pymongo import MongoClient
from pymongo.errors import DuplicateKeyError
Expand Down Expand Up @@ -39,7 +40,8 @@ async def save_file(media):
'file_id': file_id,
'file_name': file_name,
'file_size': media.file_size,
'caption': media.caption.html if media.caption else None
'caption': media.caption.html if media.caption else None,
'created_at': datetime.now()
}
found1 = {'file_name': file_name}
found = {'file_id': file_id}
Expand Down Expand Up @@ -123,9 +125,12 @@ async def get_search_results(chat_id, query, file_type=None, max_results=10, off

if MULTIPLE_DATABASE == True:
cursor1 = col.find(filter)
cursor1.sort('$natural', -1)
cursor2 = sec_col.find(filter)
cursor2.sort('$natural', -1)
else:
cursor = col.find(filter)
cursor.sort('$natural', -1)

if MULTIPLE_DATABASE == True:
files1 = [file for file in cursor1]
Expand Down

0 comments on commit 025adc2

Please sign in to comment.