Spaces:
Running
Running
BinaryONe
commited on
Commit
·
38c5fbb
1
Parent(s):
bf74c4e
Callback Update
Browse files
FileStream/bot/plugins/FileHandlers/callback.py
CHANGED
@@ -39,18 +39,15 @@ db = Database(Telegram.DATABASE_URL, Telegram.SESSION_NAME)
|
|
39 |
async def cb_data(bot: Client, update: CallbackQuery):
|
40 |
usr_cmd = update.data.split("_")
|
41 |
if usr_cmd[0] == "home":
|
42 |
-
await update.message.edit_text(text=LANG.START_TEXT.format(
|
43 |
-
update.from_user.mention, FileStream.username),
|
44 |
disable_web_page_preview=True,
|
45 |
reply_markup=BUTTON.START_BUTTONS)
|
46 |
elif usr_cmd[0] == "help":
|
47 |
-
await update.message.edit_text(text=LANG.HELP_TEXT.format(
|
48 |
-
Telegram.OWNER_ID),
|
49 |
disable_web_page_preview=True,
|
50 |
reply_markup=BUTTON.HELP_BUTTONS)
|
51 |
elif usr_cmd[0] == "about":
|
52 |
-
await update.message.edit_text(text=LANG.ABOUT_TEXT.format(
|
53 |
-
FileStream.fname, __version__),
|
54 |
disable_web_page_preview=True,
|
55 |
reply_markup=BUTTON.ABOUT_BUTTONS)
|
56 |
|
@@ -133,16 +130,16 @@ async def cb_data(bot: Client, update: CallbackQuery):
|
|
133 |
res=json.loads(imdb.get_by_id(get_imdb_id['results'][0]['id']))
|
134 |
print(f"\n** IMDB Response :{res}")
|
135 |
instruction = {
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
}
|
147 |
|
148 |
file_info = get_file_info(message, instruction)
|
@@ -320,10 +317,7 @@ async def gen_file_menu(_id, file_list_no, update: CallbackQuery):
|
|
320 |
"ʀᴇᴠᴏᴋᴇ ғɪʟᴇ",
|
321 |
callback_data=f"msgdelete_{myfile_info['_id']}_{file_list_no}")
|
322 |
],
|
323 |
-
[
|
324 |
-
InlineKeyboardButton(
|
325 |
-
"ʙᴀᴄᴋ", callback_data="userfiles_{}".format(file_list_no))
|
326 |
-
]
|
327 |
])
|
328 |
else:
|
329 |
MYFILES_BUTTONS = InlineKeyboardMarkup([
|
@@ -335,12 +329,8 @@ async def gen_file_menu(_id, file_list_no, update: CallbackQuery):
|
|
335 |
"ʀᴇᴠᴏᴋᴇ ғɪʟᴇ",
|
336 |
callback_data=f"msgdelete_{myfile_info['_id']}_{file_list_no}")
|
337 |
],
|
338 |
-
[
|
339 |
-
InlineKeyboardButton(
|
340 |
-
"ʙᴀᴄᴋ", callback_data="userfiles_{}".format(file_list_no))
|
341 |
-
]
|
342 |
])
|
343 |
-
|
344 |
TiMe = myfile_info['time']
|
345 |
if type(TiMe) == float:
|
346 |
date = datetime.datetime.fromtimestamp(TiMe)
|
@@ -420,30 +410,22 @@ async def gen_privfile_menu(_id, file_list_no, update: CallbackQuery):
|
|
420 |
InlineKeyboardButton("ᴅᴏᴡɴʟᴏᴀᴅ", url=stream_link)
|
421 |
],
|
422 |
[
|
423 |
-
|
424 |
-
|
425 |
-
InlineKeyboardButton(
|
426 |
-
"ʀᴇᴠᴏᴋᴇ ғɪʟᴇ",
|
427 |
-
callback_data=f"msgdelete_{myfile_info['_id']}_{file_list_no}")
|
428 |
],
|
429 |
[
|
430 |
-
|
431 |
-
"ʙᴀᴄᴋ", callback_data="userfiles_{}".format(file_list_no))
|
432 |
]
|
433 |
])
|
434 |
else:
|
435 |
MYFILES_BUTTONS = InlineKeyboardMarkup([
|
436 |
[InlineKeyboardButton("ᴅᴏᴡɴʟᴏᴀᴅ", url=stream_link)],
|
437 |
[
|
438 |
-
|
439 |
-
|
440 |
-
InlineKeyboardButton(
|
441 |
-
"ʀᴇᴠᴏᴋᴇ ғɪʟᴇ",
|
442 |
-
callback_data=f"msgdelete_{myfile_info['_id']}_{file_list_no}")
|
443 |
],
|
444 |
[
|
445 |
-
|
446 |
-
"ʙᴀᴄᴋ", callback_data="userfiles_{}".format(file_list_no))
|
447 |
]
|
448 |
])
|
449 |
|
|
|
39 |
async def cb_data(bot: Client, update: CallbackQuery):
|
40 |
usr_cmd = update.data.split("_")
|
41 |
if usr_cmd[0] == "home":
|
42 |
+
await update.message.edit_text(text=LANG.START_TEXT.format(update.from_user.mention, FileStream.username),
|
|
|
43 |
disable_web_page_preview=True,
|
44 |
reply_markup=BUTTON.START_BUTTONS)
|
45 |
elif usr_cmd[0] == "help":
|
46 |
+
await update.message.edit_text(text=LANG.HELP_TEXT.format(Telegram.OWNER_ID),
|
|
|
47 |
disable_web_page_preview=True,
|
48 |
reply_markup=BUTTON.HELP_BUTTONS)
|
49 |
elif usr_cmd[0] == "about":
|
50 |
+
await update.message.edit_text(text=LANG.ABOUT_TEXT.format(FileStream.fname, __version__),
|
|
|
51 |
disable_web_page_preview=True,
|
52 |
reply_markup=BUTTON.ABOUT_BUTTONS)
|
53 |
|
|
|
130 |
res=json.loads(imdb.get_by_id(get_imdb_id['results'][0]['id']))
|
131 |
print(f"\n** IMDB Response :{res}")
|
132 |
instruction = {
|
133 |
+
"privacy_type": "PUBLIC",
|
134 |
+
"user_id": user_id,
|
135 |
+
"user_type": "TELEGRAM",
|
136 |
+
"IMDB_id": get_imdb_id['results'][0]['id'],
|
137 |
+
"poster": res['poster'],
|
138 |
+
"title": res['name'],
|
139 |
+
"release_date": res["datePublished"],
|
140 |
+
"type": res['type'],
|
141 |
+
"description":res["description"],
|
142 |
+
"genre": res.get("genre", []) + (res["keywords"].split(",") if res.get("keywords") else []),
|
143 |
}
|
144 |
|
145 |
file_info = get_file_info(message, instruction)
|
|
|
317 |
"ʀᴇᴠᴏᴋᴇ ғɪʟᴇ",
|
318 |
callback_data=f"msgdelete_{myfile_info['_id']}_{file_list_no}")
|
319 |
],
|
320 |
+
[InlineKeyboardButton("ʙᴀᴄᴋ", callback_data="userfiles_{}".format(file_list_no))]
|
|
|
|
|
|
|
321 |
])
|
322 |
else:
|
323 |
MYFILES_BUTTONS = InlineKeyboardMarkup([
|
|
|
329 |
"ʀᴇᴠᴏᴋᴇ ғɪʟᴇ",
|
330 |
callback_data=f"msgdelete_{myfile_info['_id']}_{file_list_no}")
|
331 |
],
|
332 |
+
[InlineKeyboardButton("ʙᴀᴄᴋ", callback_data="userfiles_{}".format(file_list_no))]
|
|
|
|
|
|
|
333 |
])
|
|
|
334 |
TiMe = myfile_info['time']
|
335 |
if type(TiMe) == float:
|
336 |
date = datetime.datetime.fromtimestamp(TiMe)
|
|
|
410 |
InlineKeyboardButton("ᴅᴏᴡɴʟᴏᴀᴅ", url=stream_link)
|
411 |
],
|
412 |
[
|
413 |
+
InlineKeyboardButton("ɢᴇᴛ ғɪʟᴇ", callback_data=f"sendfile_{myfile_info['_id']}"),
|
414 |
+
InlineKeyboardButton("ʀᴇᴠᴏᴋᴇ ғɪʟᴇ",callback_data=f"msgdelete_{myfile_info['_id']}_{file_list_no}")
|
|
|
|
|
|
|
415 |
],
|
416 |
[
|
417 |
+
InlineKeyboardButton("ʙᴀᴄᴋ", callback_data="userfiles_{}".format(file_list_no))
|
|
|
418 |
]
|
419 |
])
|
420 |
else:
|
421 |
MYFILES_BUTTONS = InlineKeyboardMarkup([
|
422 |
[InlineKeyboardButton("ᴅᴏᴡɴʟᴏᴀᴅ", url=stream_link)],
|
423 |
[
|
424 |
+
InlineKeyboardButton("ɢᴇᴛ ғɪʟᴇ", callback_data=f"sendfile_{myfile_info['_id']}"),
|
425 |
+
InlineKeyboardButton("ʀᴇᴠᴏᴋᴇ ғɪʟᴇ",callback_data=f"msgdelete_{myfile_info['_id']}_{file_list_no}")
|
|
|
|
|
|
|
426 |
],
|
427 |
[
|
428 |
+
InlineKeyboardButton("ʙᴀᴄᴋ", callback_data="userfiles_{}".format(file_list_no))
|
|
|
429 |
]
|
430 |
])
|
431 |
|