BinaryONe
commited on
Commit
·
fe81aca
1
Parent(s):
6dbb1db
Image Enhancement
Browse files
FileStream/bot/plugins/FileHandlers/callback.py
CHANGED
@@ -105,12 +105,12 @@ async def cb_data(bot: Client, update: CallbackQuery):
|
|
105 |
|
106 |
elif usr_cmd[0] == "mainstream":
|
107 |
_id = usr_cmd[1]
|
108 |
-
|
109 |
await update.message.edit_text(
|
110 |
-
text=
|
111 |
parse_mode=ParseMode.HTML,
|
112 |
disable_web_page_preview=True,
|
113 |
-
reply_markup=
|
114 |
)
|
115 |
|
116 |
elif usr_cmd[0] == "pubup":
|
@@ -158,12 +158,12 @@ async def cb_data(bot: Client, update: CallbackQuery):
|
|
158 |
await get_file_ids(False, inserted_id, message)
|
159 |
#All the Time Get_file_ids should be called before update privacy or else tagged_users will be {}
|
160 |
await db.update_privacy(file_info)
|
161 |
-
|
162 |
await update.message.edit_text(
|
163 |
-
text=
|
164 |
parse_mode=ParseMode.HTML,
|
165 |
disable_web_page_preview=True,
|
166 |
-
reply_markup=
|
167 |
)
|
168 |
except FloodWait as e:
|
169 |
print(f"Sleeping for {str(e.value)}s")
|
@@ -224,12 +224,12 @@ async def cb_data(bot: Client, update: CallbackQuery):
|
|
224 |
#All the Time Get_file_ids should be called before update privacy or else tagged_users will be {}
|
225 |
print(file_info)
|
226 |
await db.update_privacy(file_info)
|
227 |
-
|
228 |
await update.message.edit_text(
|
229 |
-
text=
|
230 |
parse_mode=ParseMode.HTML,
|
231 |
disable_web_page_preview=True,
|
232 |
-
reply_markup=
|
233 |
)
|
234 |
except FloodWait as e:
|
235 |
print(f"Sleeping for {str(e.value)}s")
|
|
|
105 |
|
106 |
elif usr_cmd[0] == "mainstream":
|
107 |
_id = usr_cmd[1]
|
108 |
+
reply_markup,stream_text, poster = await gen_link(_id=_id)
|
109 |
await update.message.edit_text(
|
110 |
+
text=stream_text,
|
111 |
parse_mode=ParseMode.HTML,
|
112 |
disable_web_page_preview=True,
|
113 |
+
reply_markup=reply_markup,
|
114 |
)
|
115 |
|
116 |
elif usr_cmd[0] == "pubup":
|
|
|
158 |
await get_file_ids(False, inserted_id, message)
|
159 |
#All the Time Get_file_ids should be called before update privacy or else tagged_users will be {}
|
160 |
await db.update_privacy(file_info)
|
161 |
+
reply_markup, stream_text, poster = await gen_link(_id=inserted_id)
|
162 |
await update.message.edit_text(
|
163 |
+
text=stream_text,
|
164 |
parse_mode=ParseMode.HTML,
|
165 |
disable_web_page_preview=True,
|
166 |
+
reply_markup=reply_markup,
|
167 |
)
|
168 |
except FloodWait as e:
|
169 |
print(f"Sleeping for {str(e.value)}s")
|
|
|
224 |
#All the Time Get_file_ids should be called before update privacy or else tagged_users will be {}
|
225 |
print(file_info)
|
226 |
await db.update_privacy(file_info)
|
227 |
+
reply_markup,stream_text,poster = await gen_link(_id=inserted_id)
|
228 |
await update.message.edit_text(
|
229 |
+
text=stream_text,
|
230 |
parse_mode=ParseMode.HTML,
|
231 |
disable_web_page_preview=True,
|
232 |
+
reply_markup=reply_markup,
|
233 |
)
|
234 |
except FloodWait as e:
|
235 |
print(f"Sleeping for {str(e.value)}s")
|
FileStream/bot/plugins/FileHandlers/stream.py
CHANGED
@@ -75,20 +75,21 @@ async def private_receive_handler(bot: Client, message: Message):
|
|
75 |
reply = await message.reply_text(LANG.PROCESSING_TEXT)
|
76 |
file_info=get_file_info(message, instruction)
|
77 |
#This Will give a option to Public Private and temporary Upload
|
78 |
-
|
79 |
print("Response at Upload_type_func:",response)
|
80 |
-
if
|
81 |
-
await reply.
|
82 |
-
caption=response["stream_text"],
|
83 |
-
parse_mode=ParseMode.HTML,
|
84 |
-
reply_markup=response["reply_markup"])
|
85 |
-
|
86 |
-
else:
|
87 |
-
await reply.edit_text(text=response["stream_text"],
|
88 |
parse_mode=ParseMode.HTML,
|
89 |
disable_web_page_preview=True,
|
90 |
-
reply_markup=
|
91 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
except FloodWait as e:
|
93 |
print(f"Sleeping for {str(e.value)}s")
|
94 |
|
@@ -110,7 +111,7 @@ async def channel_receive_handler(bot: Client, message: Message):
|
|
110 |
try:
|
111 |
inserted_id = await db.add_file(file_info=get_file_info(message), db_type="TEMPORARY")
|
112 |
await get_file_ids(False, inserted_id, MULTI_CLIENTS, message)
|
113 |
-
|
114 |
await bot.edit_message_reply_markup(
|
115 |
chat_id=message.chat.id,
|
116 |
message_id=message.id,
|
@@ -214,12 +215,12 @@ async def reply_handler(
|
|
214 |
reply_to_msg_id=None,
|
215 |
chat_id=Telegram.PFLOG_CHANNEL)
|
216 |
|
217 |
-
|
218 |
await replied_message.edit_text(
|
219 |
-
text=f"{message_txt}\n{
|
220 |
parse_mode=ParseMode.HTML,
|
221 |
disable_web_page_preview=True,
|
222 |
-
reply_markup=
|
223 |
)
|
224 |
instruction = {
|
225 |
"privacy_type":"PRIVATE",
|
|
|
75 |
reply = await message.reply_text(LANG.PROCESSING_TEXT)
|
76 |
file_info=get_file_info(message, instruction)
|
77 |
#This Will give a option to Public Private and temporary Upload
|
78 |
+
reply_markup,stream_text, poster = await upload_type_func(get_file_info(message, instruction),reply)
|
79 |
print("Response at Upload_type_func:",response)
|
80 |
+
if poster == "None":
|
81 |
+
await reply.edit_text(text=stream_text,
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
parse_mode=ParseMode.HTML,
|
83 |
disable_web_page_preview=True,
|
84 |
+
reply_markup= reply_markup,
|
85 |
)
|
86 |
+
else:
|
87 |
+
await reply.reply_photo(photo=poster,
|
88 |
+
caption=stream_text,
|
89 |
+
parse_mode=ParseMode.HTML,
|
90 |
+
reply_markup=reply_markup
|
91 |
+
)
|
92 |
+
|
93 |
except FloodWait as e:
|
94 |
print(f"Sleeping for {str(e.value)}s")
|
95 |
|
|
|
111 |
try:
|
112 |
inserted_id = await db.add_file(file_info=get_file_info(message), db_type="TEMPORARY")
|
113 |
await get_file_ids(False, inserted_id, MULTI_CLIENTS, message)
|
114 |
+
reply_markup,streaam_text,poster = await gen_link(_id=inserted_id)
|
115 |
await bot.edit_message_reply_markup(
|
116 |
chat_id=message.chat.id,
|
117 |
message_id=message.id,
|
|
|
215 |
reply_to_msg_id=None,
|
216 |
chat_id=Telegram.PFLOG_CHANNEL)
|
217 |
|
218 |
+
reply_markup,stream_text,poster = await gen_link(_id=file_info['_id'])
|
219 |
await replied_message.edit_text(
|
220 |
+
text=f"{message_txt}\n{stream_text}",
|
221 |
parse_mode=ParseMode.HTML,
|
222 |
disable_web_page_preview=True,
|
223 |
+
reply_markup=reply_markup,
|
224 |
)
|
225 |
instruction = {
|
226 |
"privacy_type":"PRIVATE",
|
FileStream/utils/FileProcessors/bot_utils.py
CHANGED
@@ -92,13 +92,14 @@ async def upload_type_func(file_info,replied_message):
|
|
92 |
"""
|
93 |
existing_file = await db.get_file_by_fileuniqueid_only(file_info['file']['file_unique_id'], file_info['privacy_type'])
|
94 |
if existing_file :
|
95 |
-
|
96 |
#await update.message.edit_text(text=stream_text,parse_mode=ParseMode.HTML,disable_web_page_preview=True,reply_markup=reply_markup,)
|
97 |
-
return {"reply_markup" : response.get("reply_markup"), "stream_text": response.get("stream_text"),"poster":response.get("poster"),"type":"ExistingFile"}
|
98 |
-
|
99 |
else:
|
100 |
name = file_info['file']['caption'] if file_info['file']['caption'] else file_info['file']['file_name']
|
101 |
title, year = Get_Title_Year(name)
|
|
|
102 |
stream_text = LANG.STREAM_TEXT_Y.format(file_info['file']['file_name'],title+" "+str(year),humanbytes(file_info['file']['file_size']))
|
103 |
reply_markup = InlineKeyboardMarkup([
|
104 |
[
|
@@ -108,7 +109,7 @@ async def upload_type_func(file_info,replied_message):
|
|
108 |
],
|
109 |
[InlineKeyboardButton("ᴄʟᴏsᴇ", callback_data="close")]
|
110 |
])
|
111 |
-
return
|
112 |
|
113 |
|
114 |
async def priv_func(file_name, file_size):
|
@@ -195,7 +196,7 @@ async def gen_link(_id):
|
|
195 |
InlineKeyboardButton("ʀᴇᴠᴏᴋᴇ ғɪʟᴇ",callback_data=f"msgdelpvt_{_id}")
|
196 |
], [InlineKeyboardButton("ᴄʟᴏsᴇ", callback_data="close")]
|
197 |
])
|
198 |
-
return
|
199 |
|
200 |
|
201 |
#---------------------[ GEN STREAM LINKS FOR CHANNEL ]---------------------#
|
|
|
92 |
"""
|
93 |
existing_file = await db.get_file_by_fileuniqueid_only(file_info['file']['file_unique_id'], file_info['privacy_type'])
|
94 |
if existing_file :
|
95 |
+
reply_markup,stream_text,poster = await gen_link(existing_file['_id'])
|
96 |
#await update.message.edit_text(text=stream_text,parse_mode=ParseMode.HTML,disable_web_page_preview=True,reply_markup=reply_markup,)
|
97 |
+
#return {"reply_markup" : response.get("reply_markup"), "stream_text": response.get("stream_text"),"poster":response.get("poster"),"type":"ExistingFile"}
|
98 |
+
return reply_markup,stream_text,poster
|
99 |
else:
|
100 |
name = file_info['file']['caption'] if file_info['file']['caption'] else file_info['file']['file_name']
|
101 |
title, year = Get_Title_Year(name)
|
102 |
+
poster="None"
|
103 |
stream_text = LANG.STREAM_TEXT_Y.format(file_info['file']['file_name'],title+" "+str(year),humanbytes(file_info['file']['file_size']))
|
104 |
reply_markup = InlineKeyboardMarkup([
|
105 |
[
|
|
|
109 |
],
|
110 |
[InlineKeyboardButton("ᴄʟᴏsᴇ", callback_data="close")]
|
111 |
])
|
112 |
+
return reply_markup, stream_text, poster
|
113 |
|
114 |
|
115 |
async def priv_func(file_name, file_size):
|
|
|
196 |
InlineKeyboardButton("ʀᴇᴠᴏᴋᴇ ғɪʟᴇ",callback_data=f"msgdelpvt_{_id}")
|
197 |
], [InlineKeyboardButton("ᴄʟᴏsᴇ", callback_data="close")]
|
198 |
])
|
199 |
+
return reply_markup, stream_text, poster
|
200 |
|
201 |
|
202 |
#---------------------[ GEN STREAM LINKS FOR CHANNEL ]---------------------#
|
FileStream/utils/FileProcessors/custom_ul.py
CHANGED
@@ -222,12 +222,12 @@ class TeleUploader:
|
|
222 |
#await db.add_webfile(file_info)
|
223 |
inserted_id = await db.add_file(file_info=file_info,db_type="TEMPORARY")
|
224 |
await get_file_ids(False, inserted_id, MessageFile)
|
225 |
-
|
226 |
await message.edit_text(
|
227 |
-
text=
|
228 |
parse_mode=ParseMode.HTML,
|
229 |
disable_web_page_preview=True,
|
230 |
-
reply_markup=
|
231 |
)
|
232 |
|
233 |
#log_msg = await send_file(FileStream, db_id, file_info['file_id'], message)
|
|
|
222 |
#await db.add_webfile(file_info)
|
223 |
inserted_id = await db.add_file(file_info=file_info,db_type="TEMPORARY")
|
224 |
await get_file_ids(False, inserted_id, MessageFile)
|
225 |
+
reply_markup,stream_text, poster = await gen_link(_id=inserted_id)
|
226 |
await message.edit_text(
|
227 |
+
text=stream_text,
|
228 |
parse_mode=ParseMode.HTML,
|
229 |
disable_web_page_preview=True,
|
230 |
+
reply_markup=reply_markup,
|
231 |
)
|
232 |
|
233 |
#log_msg = await send_file(FileStream, db_id, file_info['file_id'], message)
|