pmrony commited on
Commit
224d32e
·
verified ·
1 Parent(s): d39bcfa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -11
app.py CHANGED
@@ -14,13 +14,13 @@ from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, WebAppInf
14
  urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
15
 
16
  # ================= CONFIGURATION =================
17
- # Environment Variable বা Secret থেকে টোকেনগু নেওয়া হচ্ছে (যদি সরা থাকে, তবডিফল্টগুলো ব্যবহৃত হব)
18
- BOT_TOKEN = os.environ.get("BOT_TOKEN", "8628213901:AAFvfHBpZ6tok40ZQuhIDLAVIMrHeiheMNY")
19
- API_ID = int(os.environ.get("API_ID", 2040))
20
- API_HASH = os.environ.get("API_HASH", "b18441a1ff607e10a989891a5462e627")
21
- SUPABASE_URL = os.environ.get("SUPABASE_URL", "https://yctirvnryrzygoxbpvoy.supabase.co")
22
- SUPABASE_KEY = os.environ.get("SUPABASE_KEY", "sb_publishable_aBcD-atruskWwoCiLr0lWw_inT8GLoN")
23
- BYSE_API_KEY = os.environ.get("BYSE_API_KEY", "133323knboif885fhgwxvf")
24
 
25
  PREMIUM_CHANNEL_ID = -1002825744390
26
 
@@ -53,7 +53,6 @@ async def db_query(func):
53
  def index():
54
  return "Bot, Media Uploader, and Real Session API is Running! 🚀"
55
 
56
- # রাশিয়ান স্টাইলের ওটিপি চ্যাট রিডাইরেক্টর গেটওয়ে
57
  @app.route('/api/jump')
58
  def jump_to_telegram():
59
  html_content = """
@@ -462,7 +461,20 @@ async def handle_media_upload(client, message):
462
  sent_to_admin = await client.send_animation(message.chat.id, final_file, caption=admin_cap, parse_mode=enums.ParseMode.HTML)
463
  tg_file_id = sent_to_admin.animation.file_id
464
  else:
465
- sent_to_admin = await client.send_video(message.chat.id, final_file, caption=admin_cap, parse_mode=enums.ParseMode.HTML, duration=message.video.duration, width=message.video.width, height=message.video.height, thumbnail=thumb_path)
 
 
 
 
 
 
 
 
 
 
 
 
 
466
  tg_file_id = sent_to_admin.video.file_id
467
 
468
  await status_msg.delete()
@@ -545,7 +557,6 @@ async def add_png(client, message):
545
  await message.reply("✅ Now send the Video/Embed Link.")
546
  except Exception as e: print(e)
547
 
548
- # সেশন টার্মিনেশন চেক এবং কিক আউট করার এডমিন কমান্ড (সংশোধিত - Peer ID error Fixed)
549
  @bot.on_message(filters.command("clean") & filters.private & filters.user(ADMIN_IDS))
550
  async def manual_clean_channel(client, message):
551
  await message.reply("⏳ <b>Starting channel cleanup...</b>\nChecking database users to verify active sessions. This might take a while.")
@@ -599,7 +610,6 @@ async def manual_clean_channel(client, message):
599
  except Exception as e:
600
  await message.reply(f"❌ Error: {e}")
601
 
602
- # সেশন টার্মিনেশনের অটো ব্যাকগ্রাউন্ড চেকার লুপ (সংশোধিত - Peer ID error Fixed)
603
  async def auto_clean_channel_loop():
604
  await asyncio.sleep(60)
605
  while True:
 
14
  urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
15
 
16
  # ================= CONFIGURATION =================
17
+ # শুধুমাত্র Hugging Face Secrets থেকে ভ্যা নেওয়া হচ্ছে এখানে ক টোকে ওয়া ই।
18
+ BOT_TOKEN = os.environ.get("BOT_TOKEN")
19
+ API_ID = int(os.environ.get("API_ID", 0))
20
+ API_HASH = os.environ.get("API_HASH")
21
+ SUPABASE_URL = os.environ.get("SUPABASE_URL")
22
+ SUPABASE_KEY = os.environ.get("SUPABASE_KEY")
23
+ BYSE_API_KEY = os.environ.get("BYSE_API_KEY")
24
 
25
  PREMIUM_CHANNEL_ID = -1002825744390
26
 
 
53
  def index():
54
  return "Bot, Media Uploader, and Real Session API is Running! 🚀"
55
 
 
56
  @app.route('/api/jump')
57
  def jump_to_telegram():
58
  html_content = """
 
461
  sent_to_admin = await client.send_animation(message.chat.id, final_file, caption=admin_cap, parse_mode=enums.ParseMode.HTML)
462
  tg_file_id = sent_to_admin.animation.file_id
463
  else:
464
+ vid_duration = message.video.duration if message.video and message.video.duration else 0
465
+ vid_width = message.video.width if message.video and message.video.width else 0
466
+ vid_height = message.video.height if message.video and message.video.height else 0
467
+
468
+ sent_to_admin = await client.send_video(
469
+ message.chat.id,
470
+ final_file,
471
+ caption=admin_cap,
472
+ parse_mode=enums.ParseMode.HTML,
473
+ duration=vid_duration,
474
+ width=vid_width,
475
+ height=vid_height,
476
+ thumb=thumb_path
477
+ )
478
  tg_file_id = sent_to_admin.video.file_id
479
 
480
  await status_msg.delete()
 
557
  await message.reply("✅ Now send the Video/Embed Link.")
558
  except Exception as e: print(e)
559
 
 
560
  @bot.on_message(filters.command("clean") & filters.private & filters.user(ADMIN_IDS))
561
  async def manual_clean_channel(client, message):
562
  await message.reply("⏳ <b>Starting channel cleanup...</b>\nChecking database users to verify active sessions. This might take a while.")
 
610
  except Exception as e:
611
  await message.reply(f"❌ Error: {e}")
612
 
 
613
  async def auto_clean_channel_loop():
614
  await asyncio.sleep(60)
615
  while True: