BinaryONe commited on
Commit
278d044
ยท
1 Parent(s): c140fac

Callback Update

Browse files
FileStream/bot/plugins/FileHandlers/callback.py CHANGED
@@ -171,6 +171,69 @@ async def cb_data(bot: Client, update: CallbackQuery):
171
  chat_id=Telegram.ULOG_GROUP,
172
  text=f"An error occurred: {str(e)}"
173
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
 
175
  elif usr_cmd[0] == "privup":
176
  try:
 
171
  chat_id=Telegram.ULOG_GROUP,
172
  text=f"An error occurred: {str(e)}"
173
  )
174
+ elif usr_cmd[0] == "tempup":
175
+ try:
176
+ print("Public Upload :",usr_cmd)
177
+ user_id = str(usr_cmd[1])
178
+ message_id = int(usr_cmd[2])
179
+ message = await FileStream.get_messages(user_id, message_id)
180
+ #response = await FileStream.get_messages(user_id, response_id)
181
+ #print(f"Message:{message}")
182
+ name = getattr(message, "caption", f"{get_name(message)}" ) or "None/Unknown"
183
+ #file_name = get_name(message)
184
+ #name = file_caption if (file_caption) != "None/Unknown" else file_name
185
+ from FileStream.Tools.cleanup import Get_Title_Year
186
+ title, year = Get_Title_Year(name)
187
+ print(f"** ANY SEARCH :{name} YEAR :{year}")
188
+ get_imdb_id = json.loads(imdb.search(title, year=int(year)))
189
+ #print(f"ANY SEARCH :{title} YEAR :{year} IMDB Response :{res}")
190
+ #print("TMDB",search_tmdb_any(title, year))
191
+ #print(f"IMDB ID :{get_imdb_id['results'][0]['id']}")
192
+ print(f"\n** GET_ID {get_imdb_id}")
193
+ res=json.loads(imdb.get_by_id(get_imdb_id['results'][0]['id']))
194
+ print(f"\n** IMDB Response :{res}")
195
+ instruction = {
196
+ "privacy_type": "PUBLIC",
197
+ "user_id": user_id,
198
+ "user_type": "TELEGRAM",
199
+ "IMDB_id": get_imdb_id['results'][0]['id'],
200
+ "poster": res['poster'],
201
+ "title": res['name'],
202
+ "release_date": res["datePublished"],
203
+ "type": res['type'],
204
+ "description":res["description"],
205
+ "keywords":res["keywords"].split(",") if res.get("keywords") else [],
206
+ "genre": res.get("genre", []) ,
207
+ }
208
+
209
+ file_info = get_file_info(message, instruction)
210
+ # Here we are Adding the File Into the database First
211
+ inserted_id = await db.add_file(file_info)
212
+ await get_file_ids(False, inserted_id, message)
213
+ #All the Time Get_file_ids should be called before update privacy or else tagged_users will be {}
214
+ await db.update_privacy(file_info)
215
+ reply_markup, stream_text = await gen_link(_id=inserted_id)
216
+ await update.message.edit_text(
217
+ text=stream_text,
218
+ parse_mode=ParseMode.HTML,
219
+ disable_web_page_preview=True,
220
+ reply_markup=reply_markup,
221
+ )
222
+ except FloodWait as e:
223
+ print(f"Sleeping for {str(e.value)}s")
224
+ await asyncio.sleep(e.value)
225
+ await FileStream.send_message(
226
+ chat_id=Telegram.ULOG_GROUP,
227
+ text=
228
+ f"Gแดแด› FสŸแดแดแด…Wแด€ษชแด› แดา“ {str(e.value)}s า“ส€แดแด [{message.from_user.first_name}](tg://user?id={message.from_user.id})\n\n**แดœsแด‡ส€ ษชแด… :** `{str(message.from_user.id)}`",
229
+ disable_web_page_preview=True,
230
+ parse_mode=ParseMode.MARKDOWN)
231
+ except Exception as e:
232
+ print(f"An error occurred: {str(e)}")
233
+ await FileStream.send_message(
234
+ chat_id=Telegram.ULOG_GROUP,
235
+ text=f"An error occurred: {str(e)}"
236
+ )
237
 
238
  elif usr_cmd[0] == "privup":
239
  try:
FileStream/bot/plugins/FileHandlers/stream.py CHANGED
@@ -74,6 +74,7 @@ async def private_receive_handler(bot: Client, message: Message):
74
 
75
  reply = await message.reply_text(LANG.PROCESSING_TEXT)
76
  file_info=get_file_info(message, instruction)
 
77
  reply_markup, stream_text = await upload_type_func(get_file_info(message, instruction),reply)
78
  await reply.edit_text(text=stream_text,
79
  parse_mode=ParseMode.HTML,
 
74
 
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 = await upload_type_func(get_file_info(message, instruction),reply)
79
  await reply.edit_text(text=stream_text,
80
  parse_mode=ParseMode.HTML,
FileStream/config.py CHANGED
@@ -17,21 +17,14 @@ class Telegram:
17
  FORCE_SUB = env.get('FORCE_UPDATES_CHANNEL', False)
18
  FORCE_SUB = True if str(FORCE_SUB).lower() == "true" else False
19
  SLEEP_THRESHOLD = int(env.get("SLEEP_THRESHOLD", "60"))
20
- FILE_PIC = env.get(
21
- 'FILE_PIC',
22
- "https://graph.org/file/5bb9935be0229adf98b73.jpg")
23
- START_PIC = env.get(
24
- 'START_PIC',
25
- "https://graph.org/file/290af25276fa34fa8f0aa.jpg")
26
- VERIFY_PIC = env.get(
27
- 'VERIFY_PIC',
28
- "https://graph.org/file/736e21cc0efa4d8c2a0e4.jpg")
29
  MULTI_CLIENT = False
30
- FLOG_CHANNEL = int(env.get(
31
- "FLOG_CHANNEL", None)) # Logs channel for file logs
32
  PFLOG_CHANNEL = int(env.get("PFLOG_CHANNEL"))
33
- ULOG_GROUP = int(env.get(
34
- "ULOG_GROUP", None)) # Logs channel for user logs
35
  MODE = env.get("MODE", "primary")
36
  SECONDARY = True if MODE.lower() == "secondary" else False
37
  AUTH_USERS = list(set(int(x)for x in str(env.get("AUTH_USERS", "")).split()))
 
17
  FORCE_SUB = env.get('FORCE_UPDATES_CHANNEL', False)
18
  FORCE_SUB = True if str(FORCE_SUB).lower() == "true" else False
19
  SLEEP_THRESHOLD = int(env.get("SLEEP_THRESHOLD", "60"))
20
+ FILE_PIC = env.get('FILE_PIC',"https://graph.org/file/5bb9935be0229adf98b73.jpg")
21
+ START_PIC = env.get('START_PIC',"https://graph.org/file/290af25276fa34fa8f0aa.jpg")
22
+ VERIFY_PIC = env.get('VERIFY_PIC',"https://graph.org/file/736e21cc0efa4d8c2a0e4.jpg")
 
 
 
 
 
 
23
  MULTI_CLIENT = False
24
+ FLOG_CHANNEL = int(env.get("FLOG_CHANNEL", None)) # Logs channel for file logs
 
25
  PFLOG_CHANNEL = int(env.get("PFLOG_CHANNEL"))
26
+ TFLOG_CHANNEL = int(env.get("TFLOG_CHANNEL", None))
27
+ ULOG_GROUP = int(env.get("ULOG_GROUP", None)) # Logs channel for user logs
28
  MODE = env.get("MODE", "primary")
29
  SECONDARY = True if MODE.lower() == "secondary" else False
30
  AUTH_USERS = list(set(int(x)for x in str(env.get("AUTH_USERS", "")).split()))
FileStream/utils/FileProcessors/bot_utils.py CHANGED
@@ -113,12 +113,16 @@ async def upload_type_func(file_info,replied_message):
113
  stream_text = LANG.STREAM_TEXT_Y.format(file_info['file']['file_name'],str(title+" "+year),humanbytes(file_info['file']['file_size']))
114
  reply_markup = InlineKeyboardMarkup([[
115
  InlineKeyboardButton(
116
- "PUBLIC UPLOAD",
117
  callback_data=f"pubup_{file_info['user_id']}_{file_info['message_id']}"),
118
  InlineKeyboardButton(
119
- "PRIVATE UPLOAD",
120
  callback_data=
121
- f"privup_{file_info['user_id']}_{file_info['message_id']}")
 
 
 
 
122
  ], [InlineKeyboardButton("แด„สŸแดsแด‡", callback_data="close")]])
123
 
124
  return reply_markup, stream_text
 
113
  stream_text = LANG.STREAM_TEXT_Y.format(file_info['file']['file_name'],str(title+" "+year),humanbytes(file_info['file']['file_size']))
114
  reply_markup = InlineKeyboardMarkup([[
115
  InlineKeyboardButton(
116
+ "PUBLIC",
117
  callback_data=f"pubup_{file_info['user_id']}_{file_info['message_id']}"),
118
  InlineKeyboardButton(
119
+ "PRIVATE",
120
  callback_data=
121
+ f"privup_{file_info['user_id']}_{file_info['message_id']}"),
122
+ InlineKeyboardButton(
123
+ "TEMPORARY",
124
+ callback_data=
125
+ f"tempup_{file_info['user_id']}_{file_info['message_id']}")
126
  ], [InlineKeyboardButton("แด„สŸแดsแด‡", callback_data="close")]])
127
 
128
  return reply_markup, stream_text
FileStream/utils/FileProcessors/translation.py CHANGED
@@ -42,7 +42,7 @@ class LANG(object):
42
  <b>๐Ÿ”— Sสœแด€ส€แด‡ :</b> <code>{}</code>\n"""
43
 
44
  STREAM_TEXT_Y = """
45
- <b>๐Ÿช‚ : ๐”น๐•Šโ„™๐”ธโ„๐•‚ ๐”ปโ„๐•€๐•๐”ผ : ๐Ÿช‚</b>\n
46
  <b>๐Ÿ“‚ FษชสŸแด‡ ษดแด€แดแด‡ :</b> <b>{}</b>\n
47
  <b>๐Ÿ“‚ ๐–ฃ๐–พ๐—‹๐—‚๐—๐–พ๐–ฝ ๐–ญ๐–บ๐—†๐–พ :</b> <b>{}</b>\n
48
  <b>๐Ÿ“ฆ FษชสŸแด‡ ๊œฑษชแดขแด‡ :</b> <code>{}</code>\n
 
42
  <b>๐Ÿ”— Sสœแด€ส€แด‡ :</b> <code>{}</code>\n"""
43
 
44
  STREAM_TEXT_Y = """
45
+ <b>๐Ÿช‚ : ๐•Œ๐•ก๐•๐• ๐•’๐•• ๐”ฝ๐•š๐•๐•– : ๐Ÿช‚</b>\n
46
  <b>๐Ÿ“‚ FษชสŸแด‡ ษดแด€แดแด‡ :</b> <b>{}</b>\n
47
  <b>๐Ÿ“‚ ๐–ฃ๐–พ๐—‹๐—‚๐—๐–พ๐–ฝ ๐–ญ๐–บ๐—†๐–พ :</b> <b>{}</b>\n
48
  <b>๐Ÿ“ฆ FษชสŸแด‡ ๊œฑษชแดขแด‡ :</b> <code>{}</code>\n