AngryBird-22 commited on
Commit
b486805
·
verified ·
1 Parent(s): 5dc4327

Update mfinder/plugins/serve.py

Browse files
Files changed (1) hide show
  1. mfinder/plugins/serve.py +27 -12
mfinder/plugins/serve.py CHANGED
@@ -448,11 +448,11 @@ async def create_and_send_token_link(bot, update, admin_settings, search_query=N
448
  text = (
449
  "⚠️ **Verification Required!**\n\n"
450
  "To search for movies and download files, you need to quickly verify your access:\n\n"
451
- '1. Click the "🔑 Generate Access Token" button below.\n'
452
  "2. Complete the quick verification link (ads page).\n"
453
  "3. Once done, you will get free, ad-free search access for the next few hours!\n\n"
454
- '❓ Any doubts? Click the "How to Verify / How to Download" button below to watch the tutorial video!\n\n'
455
- "⏱️ Note: Once verified, files will download instantly with no ads!"
456
  )
457
 
458
  from mfinder.utils.helpers import get_how_to_download_for_url
@@ -475,11 +475,18 @@ async def create_and_send_token_link(bot, update, admin_settings, search_query=N
475
  [InlineKeyboardButton("❓ How to Verify ❓", url=how_to_download_url)]
476
  ])
477
 
478
- sent_msg = await update.reply_text(
479
- text=text,
480
- reply_markup=markup,
481
- quote=True
482
- )
 
 
 
 
 
 
 
483
 
484
  try:
485
  from mfinder.db.settings_sql import update_user_token_msg_id
@@ -776,7 +783,7 @@ async def movie_selection(bot, query):
776
  if admin_settings and admin_settings.token_shortener_enabled and user_id not in ADMINS:
777
  if not await is_token_valid(user_id):
778
  await query.answer("⚠️ Access token required. Generating token link...", show_alert=True)
779
- await create_and_send_token_link(bot, query.message, admin_settings, search_query=movie_title)
780
  return
781
 
782
  await query.answer(f"Fetching files for {movie_title}...", cache_time=5)
@@ -1272,7 +1279,9 @@ async def get_result(search, page_no, user_id, username, query_hash=None):
1272
  short_url = short_urls[idx]
1273
 
1274
  if button_mode == "ON":
1275
- btn_kb = InlineKeyboardButton(text=f"{filename}", url=short_url)
 
 
1276
  btn.append([btn_kb])
1277
  elif link_mode == "ON":
1278
  index += 1
@@ -1282,9 +1291,15 @@ async def get_result(search, page_no, user_id, username, query_hash=None):
1282
  else:
1283
  index += 1
1284
  btn_count += 1
1285
- filename = f"**{index}.** `{file.file_name}` - `[{get_size(file.file_size)}]`"
 
 
1286
  result += "\n" + filename
1287
- btn_kb = InlineKeyboardButton(text=f"{index}", url=short_url)
 
 
 
 
1288
  if btn_count == 1 or btn_count == 6:
1289
  btn.append([btn_kb])
1290
  elif 6 > btn_count > 1:
 
448
  text = (
449
  "⚠️ **Verification Required!**\n\n"
450
  "To search for movies and download files, you need to quickly verify your access:\n\n"
451
+ '1. Click the **"🔑 Generate Access Token"** button below.\n'
452
  "2. Complete the quick verification link (ads page).\n"
453
  "3. Once done, you will get free, ad-free search access for the next few hours!\n\n"
454
+ '> **Any doubts?** Click the **"How to Verify / How to Download"** button below to watch the tutorial video!\n\n'
455
+ "⏱️ **Note:** Once verified, files will download instantly with no ads!"
456
  )
457
 
458
  from mfinder.utils.helpers import get_how_to_download_for_url
 
475
  [InlineKeyboardButton("❓ How to Verify ❓", url=how_to_download_url)]
476
  ])
477
 
478
+ if isinstance(update, CallbackQuery):
479
+ sent_msg = await update.message.reply_text(
480
+ text=text,
481
+ reply_markup=markup,
482
+ quote=True
483
+ )
484
+ else:
485
+ sent_msg = await update.reply_text(
486
+ text=text,
487
+ reply_markup=markup,
488
+ quote=True
489
+ )
490
 
491
  try:
492
  from mfinder.db.settings_sql import update_user_token_msg_id
 
783
  if admin_settings and admin_settings.token_shortener_enabled and user_id not in ADMINS:
784
  if not await is_token_valid(user_id):
785
  await query.answer("⚠️ Access token required. Generating token link...", show_alert=True)
786
+ await create_and_send_token_link(bot, query, admin_settings, search_query=movie_title)
787
  return
788
 
789
  await query.answer(f"Fetching files for {movie_title}...", cache_time=5)
 
1279
  short_url = short_urls[idx]
1280
 
1281
  if button_mode == "ON":
1282
+ btn_kb = InlineKeyboardButton(
1283
+ text=f"{filename}", url=short_url
1284
+ )
1285
  btn.append([btn_kb])
1286
  elif link_mode == "ON":
1287
  index += 1
 
1291
  else:
1292
  index += 1
1293
  btn_count += 1
1294
+ filename = (
1295
+ f"**{index}.** `{file.file_name}` - `[{get_size(file.file_size)}]`"
1296
+ )
1297
  result += "\n" + filename
1298
+
1299
+ btn_kb = InlineKeyboardButton(
1300
+ text=f"{index}", url=short_url
1301
+ )
1302
+
1303
  if btn_count == 1 or btn_count == 6:
1304
  btn.append([btn_kb])
1305
  elif 6 > btn_count > 1: