BinaryONe
commited on
Commit
·
9c83245
1
Parent(s):
6691551
changes In Upload
Browse files
FileStream/Database/database.py
CHANGED
|
@@ -51,35 +51,27 @@ class Database:
|
|
| 51 |
|
| 52 |
def NewTG_Files(self, details):
|
| 53 |
return {
|
| 54 |
-
"user_id":
|
| 55 |
-
details['
|
| 56 |
-
"
|
| 57 |
-
details['
|
| 58 |
-
"
|
| 59 |
-
|
| 60 |
-
"
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
"file": {
|
| 63 |
-
"file_id":
|
| 64 |
-
|
| 65 |
-
"file_unique_id":
|
| 66 |
-
details['file']['
|
| 67 |
-
if details['file']['
|
| 68 |
-
"
|
| 69 |
-
details['file']['file_name']
|
| 70 |
-
if details['file']['file_name'] else None,
|
| 71 |
-
"file_size":
|
| 72 |
-
details['file']['file_size']
|
| 73 |
-
if details['file']['file_size'] else None,
|
| 74 |
-
"mime_type":
|
| 75 |
-
details['file']['mime_type']
|
| 76 |
-
if details['file']['mime_type'] else None,
|
| 77 |
"taged_users": {}
|
| 78 |
},
|
| 79 |
-
"time":
|
| 80 |
-
details['time'] if details['time'] else None,
|
| 81 |
-
"privacy_type":
|
| 82 |
-
details['privacy_type'] if details['privacy_type'] else None,
|
| 83 |
}
|
| 84 |
|
| 85 |
# ---------------------[ ADD USER ]---------------------#
|
|
|
|
| 51 |
|
| 52 |
def NewTG_Files(self, details):
|
| 53 |
return {
|
| 54 |
+
"user_id": details['user_id'] if details['user_id'] else None,
|
| 55 |
+
"user_type": details['user_type'] if details['user_type'] else None,
|
| 56 |
+
"message_id": details['message_id'] if details['message_id'] else None,
|
| 57 |
+
"location":details['location'] if details['location'] else None,
|
| 58 |
+
"TMDB_id": int(),
|
| 59 |
+
"title": "Unknown",
|
| 60 |
+
"type":"Unknown",
|
| 61 |
+
"subtype":"Unknown",
|
| 62 |
+
"quality":"Unknown",
|
| 63 |
+
"time": details['time'] if details['time'] else None,
|
| 64 |
+
"privacy_type": details['privacy_type'] if details['privacy_type'] else None,
|
| 65 |
+
"file_ids":{},
|
| 66 |
"file": {
|
| 67 |
+
"file_id":details['file']['file_id'] if details['file']['file_id'] else None,
|
| 68 |
+
"caption":"",
|
| 69 |
+
"file_unique_id": details['file']['file_unique_id'] if details['file']['file_unique_id'] else None,
|
| 70 |
+
"file_name":details['file']['file_name'] if details['file']['file_name'] else None,
|
| 71 |
+
"file_size":details['file']['file_size'] if details['file']['file_size'] else None,
|
| 72 |
+
"mime_type":details['file']['mime_type']if details['file']['mime_type'] else None,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
"taged_users": {}
|
| 74 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
}
|
| 76 |
|
| 77 |
# ---------------------[ ADD USER ]---------------------#
|
FileStream/bot/plugins/FileHandlers/callback.py
CHANGED
|
@@ -18,7 +18,7 @@ from FileStream.Exceptions import FileNotFound # Corrected the import statement
|
|
| 18 |
from FileStream.utils.FileProcessors.translation import LANG, BUTTON
|
| 19 |
from FileStream.utils.FileProcessors.human_readable import humanbytes
|
| 20 |
from FileStream.bot.plugins.FileHandlers.stream import private_receive_handler
|
| 21 |
-
from FileStream.utils.FileProcessors.file_properties import get_file_ids, get_file_info
|
| 22 |
from FileStream.utils.FileProcessors.bot_utils import gen_link, priv_func, gen_priv_file_link
|
| 23 |
#-----------------Starting Point --------------------------#
|
| 24 |
|
|
@@ -112,6 +112,11 @@ async def cb_data(bot: Client, update: CallbackQuery):
|
|
| 112 |
"user_id": user_id,
|
| 113 |
"user_type": "TELEGRAM"
|
| 114 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
file_info = get_file_info(message, instruction)
|
| 116 |
# Here we are Adding the File Into the database First
|
| 117 |
inserted_id = await db.add_file(file_info)
|
|
@@ -147,6 +152,7 @@ async def cb_data(bot: Client, update: CallbackQuery):
|
|
| 147 |
message_id = int(usr_cmd[2])
|
| 148 |
message = await FileStream.get_messages(user_id, message_id)
|
| 149 |
instruction = {
|
|
|
|
| 150 |
"privacy_type": "PRIVATE",
|
| 151 |
"user_id": user_id,
|
| 152 |
"user_type": "TELEGRAM"
|
|
|
|
| 18 |
from FileStream.utils.FileProcessors.translation import LANG, BUTTON
|
| 19 |
from FileStream.utils.FileProcessors.human_readable import humanbytes
|
| 20 |
from FileStream.bot.plugins.FileHandlers.stream import private_receive_handler
|
| 21 |
+
from FileStream.utils.FileProcessors.file_properties import get_file_ids, get_file_info,get_name
|
| 22 |
from FileStream.utils.FileProcessors.bot_utils import gen_link, priv_func, gen_priv_file_link
|
| 23 |
#-----------------Starting Point --------------------------#
|
| 24 |
|
|
|
|
| 112 |
"user_id": user_id,
|
| 113 |
"user_type": "TELEGRAM"
|
| 114 |
}
|
| 115 |
+
file_caption = getattr(message, "caption", f"{get_name(message)}" ) or "None/Unknown"
|
| 116 |
+
file_name = get_name(message)
|
| 117 |
+
print("Daetail",file_caption,file_name)
|
| 118 |
+
polls=await FileStream.send_poll(chat_id, "Is this a poll question?", ["Yes", "No", "Maybe"])
|
| 119 |
+
print(polls)
|
| 120 |
file_info = get_file_info(message, instruction)
|
| 121 |
# Here we are Adding the File Into the database First
|
| 122 |
inserted_id = await db.add_file(file_info)
|
|
|
|
| 152 |
message_id = int(usr_cmd[2])
|
| 153 |
message = await FileStream.get_messages(user_id, message_id)
|
| 154 |
instruction = {
|
| 155 |
+
|
| 156 |
"privacy_type": "PRIVATE",
|
| 157 |
"user_id": user_id,
|
| 158 |
"user_type": "TELEGRAM"
|
FileStream/server/API/listings.py
ADDED
|
File without changes
|