Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -363,10 +363,28 @@ async def save_progress(source_id, dest_id, msg_id):
|
|
| 363 |
except Exception as e: print(f"Error saving progress: {e}")
|
| 364 |
|
| 365 |
|
| 366 |
-
# ================= FIXED AUTO SHARE LOGIC
|
| 367 |
async def auto_share_loop(client, target_chat_id, delay=300):
|
| 368 |
global auto_share_running
|
| 369 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 370 |
while auto_share_running:
|
| 371 |
try:
|
| 372 |
progress_res = await db_query(lambda: supabase.table('clone_progress').select('last_copied_id').eq('source_id', STORAGE_CHANNEL_ID).eq('dest_id', target_chat_id).execute())
|
|
@@ -415,7 +433,11 @@ async def auto_share_loop(client, target_chat_id, delay=300):
|
|
| 415 |
for msg in batch_to_send:
|
| 416 |
if not auto_share_running: break
|
| 417 |
try:
|
| 418 |
-
sent = await msg.copy(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 419 |
sent_message_ids.append(sent.id)
|
| 420 |
last_sent_id = msg.id
|
| 421 |
await asyncio.sleep(1.5)
|
|
@@ -458,7 +480,7 @@ async def start_sharing_cmd(client, message):
|
|
| 458 |
|
| 459 |
auto_share_running = True
|
| 460 |
auto_share_task = asyncio.create_task(auto_share_loop(client, TARGET_SHARE_GROUP, 300))
|
| 461 |
-
await message.reply(f"✅ <b>Auto-sharing started!</b>\n\n📌 <b>Target Group:</b> <code>{TARGET_SHARE_GROUP}</code>\n📦 <b>Batch Size:</b> 5 videos\n⏱ <b>Interval:</b> 5 minutes\n\n<i>Bot will send 5 videos
|
| 462 |
|
| 463 |
@bot.on_message(filters.command("stopshare") & filters.private & filters.user(ADMIN_IDS))
|
| 464 |
async def stop_sharing_cmd(client, message):
|
|
@@ -515,10 +537,15 @@ async def start(client, message):
|
|
| 515 |
first_name = message.from_user.first_name
|
| 516 |
args = message.command
|
| 517 |
referrer_id = None
|
|
|
|
| 518 |
|
|
|
|
| 519 |
if len(args) > 1:
|
| 520 |
-
|
| 521 |
-
|
|
|
|
|
|
|
|
|
|
| 522 |
|
| 523 |
user_check = await db_query(lambda: supabase.table('referrals').select('*').eq('user_id', user_id).execute())
|
| 524 |
|
|
@@ -540,12 +567,20 @@ async def start(client, message):
|
|
| 540 |
print(f"Error handling referral DB entry: {db_err}")
|
| 541 |
|
| 542 |
bot_me = client.me if client.me else await client.get_me()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 543 |
markup = InlineKeyboardMarkup([
|
| 544 |
-
[InlineKeyboardButton(
|
| 545 |
[InlineKeyboardButton("📢 Add to Group", url=f"https://t.me/{bot_me.username}?startgroup=true")]
|
| 546 |
])
|
| 547 |
|
| 548 |
-
welcome_text = (f"Hello <b>{first_name}</b>! 👋\n\n🎁 <b>Welcome to Video Unlocker Pro!</b>\nHere you can watch premium leaked and viral videos completely for FREE.\n\n👇 <b>Click the button below to Open App:</b>")
|
| 549 |
await message.reply(welcome_text, parse_mode=enums.ParseMode.HTML, reply_markup=markup)
|
| 550 |
except Exception as e: print(f"Start error: {e}")
|
| 551 |
|
|
@@ -579,8 +614,16 @@ async def bot_added_to_group(client, message):
|
|
| 579 |
msg_id = last_record['last_copied_id']
|
| 580 |
|
| 581 |
bot_link = f"https://t.me/{me.username}"
|
| 582 |
-
caption_text =
|
| 583 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 584 |
|
| 585 |
await asyncio.sleep(2)
|
| 586 |
await client.copy_message(message.chat.id, src_chat, msg_id, caption=caption_text, reply_markup=group_markup)
|
|
@@ -946,11 +989,23 @@ async def handle_media_upload(client, message):
|
|
| 946 |
|
| 947 |
await status_msg.edit_text("⏳ Preparing to broadcast to groups...")
|
| 948 |
if media_type == "video":
|
| 949 |
-
caption_text =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 950 |
else:
|
| 951 |
-
caption_text =
|
| 952 |
-
|
| 953 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 954 |
|
| 955 |
admin_cap = (
|
| 956 |
f"✅ <b>Upload and Processing Complete!</b>\n\n"
|
|
|
|
| 363 |
except Exception as e: print(f"Error saving progress: {e}")
|
| 364 |
|
| 365 |
|
| 366 |
+
# ================= FIXED AUTO SHARE LOGIC =================
|
| 367 |
async def auto_share_loop(client, target_chat_id, delay=300):
|
| 368 |
global auto_share_running
|
| 369 |
|
| 370 |
+
try:
|
| 371 |
+
bot_me = client.me if client.me else await client.get_me()
|
| 372 |
+
bot_link = f"https://t.me/{bot_me.username}"
|
| 373 |
+
except:
|
| 374 |
+
bot_link = "https://t.me/your_bot"
|
| 375 |
+
|
| 376 |
+
caption_text = (
|
| 377 |
+
f"🔥 <b>New Premium Viral Video Leaked!</b> 🔞\n\n"
|
| 378 |
+
f"🎬 <b>Watch HD Video Here:</b>\n"
|
| 379 |
+
f"👉 <b><a href='{bot_link}'>▶️ Click Here to Watch</a></b>\n\n"
|
| 380 |
+
f"🎁 <b>App এর ভেতর 'Secret Box' ওপেন করে Premium Channel Claim করুন!</b> 👇"
|
| 381 |
+
)
|
| 382 |
+
# ২টা বাটন: একটা ভিডিও দেখার, অন্যটা সিক্রেট বক্সের
|
| 383 |
+
group_markup = InlineKeyboardMarkup([
|
| 384 |
+
[InlineKeyboardButton("🎬 Watch Full Video Here 🔞", url=bot_link)],
|
| 385 |
+
[InlineKeyboardButton("🎁 Open Secret Box", url=f"{bot_link}?start=secretbox")]
|
| 386 |
+
])
|
| 387 |
+
|
| 388 |
while auto_share_running:
|
| 389 |
try:
|
| 390 |
progress_res = await db_query(lambda: supabase.table('clone_progress').select('last_copied_id').eq('source_id', STORAGE_CHANNEL_ID).eq('dest_id', target_chat_id).execute())
|
|
|
|
| 433 |
for msg in batch_to_send:
|
| 434 |
if not auto_share_running: break
|
| 435 |
try:
|
| 436 |
+
sent = await msg.copy(
|
| 437 |
+
target_chat_id,
|
| 438 |
+
caption=caption_text,
|
| 439 |
+
reply_markup=group_markup
|
| 440 |
+
)
|
| 441 |
sent_message_ids.append(sent.id)
|
| 442 |
last_sent_id = msg.id
|
| 443 |
await asyncio.sleep(1.5)
|
|
|
|
| 480 |
|
| 481 |
auto_share_running = True
|
| 482 |
auto_share_task = asyncio.create_task(auto_share_loop(client, TARGET_SHARE_GROUP, 300))
|
| 483 |
+
await message.reply(f"✅ <b>Auto-sharing started!</b>\n\n📌 <b>Target Group:</b> <code>{TARGET_SHARE_GROUP}</code>\n📦 <b>Batch Size:</b> 5 videos\n⏱ <b>Interval:</b> 5 minutes\n\n<i>Bot will send 5 videos with new caption & Secret Box button!</i>", parse_mode=enums.ParseMode.HTML)
|
| 484 |
|
| 485 |
@bot.on_message(filters.command("stopshare") & filters.private & filters.user(ADMIN_IDS))
|
| 486 |
async def stop_sharing_cmd(client, message):
|
|
|
|
| 537 |
first_name = message.from_user.first_name
|
| 538 |
args = message.command
|
| 539 |
referrer_id = None
|
| 540 |
+
is_secret = False
|
| 541 |
|
| 542 |
+
# Secret Box থেকে এসেছে কিনা সেটা চেক করা হচ্ছে
|
| 543 |
if len(args) > 1:
|
| 544 |
+
if args[1] == "secretbox":
|
| 545 |
+
is_secret = True
|
| 546 |
+
else:
|
| 547 |
+
try: referrer_id = int(args[1])
|
| 548 |
+
except ValueError: pass
|
| 549 |
|
| 550 |
user_check = await db_query(lambda: supabase.table('referrals').select('*').eq('user_id', user_id).execute())
|
| 551 |
|
|
|
|
| 567 |
print(f"Error handling referral DB entry: {db_err}")
|
| 568 |
|
| 569 |
bot_me = client.me if client.me else await client.get_me()
|
| 570 |
+
|
| 571 |
+
# যদি Secret Box-এর বাটনে ক্লিক করে আসে, তাহলে স্পেশাল মেসেজ এবং বাটন দেওয়া হবে
|
| 572 |
+
if is_secret:
|
| 573 |
+
btn_text = "🎁 Open App & Claim Premium"
|
| 574 |
+
welcome_text = (f"Hello <b>{first_name}</b>! 👋\n\n🎁 <b>Secret Box Unlock করুন!</b>\nনিচের বাটনে ক্লিক করে অ্যাপটি ওপেন করুন এবং আপনার নাম্বার ভেরিফাই করে Premium Channel Claim করে নিন!\n\n👇 <b>Click the button below:</b>")
|
| 575 |
+
else:
|
| 576 |
+
btn_text = "🔥 Play Viral Videos 🔞"
|
| 577 |
+
welcome_text = (f"Hello <b>{first_name}</b>! 👋\n\n🎁 <b>Welcome to Video Unlocker Pro!</b>\nHere you can watch premium leaked and viral videos completely for FREE.\n\n👇 <b>Click the button below to Open App:</b>")
|
| 578 |
+
|
| 579 |
markup = InlineKeyboardMarkup([
|
| 580 |
+
[InlineKeyboardButton(btn_text, web_app=WebAppInfo(url=WEB_APP_URL))],
|
| 581 |
[InlineKeyboardButton("📢 Add to Group", url=f"https://t.me/{bot_me.username}?startgroup=true")]
|
| 582 |
])
|
| 583 |
|
|
|
|
| 584 |
await message.reply(welcome_text, parse_mode=enums.ParseMode.HTML, reply_markup=markup)
|
| 585 |
except Exception as e: print(f"Start error: {e}")
|
| 586 |
|
|
|
|
| 614 |
msg_id = last_record['last_copied_id']
|
| 615 |
|
| 616 |
bot_link = f"https://t.me/{me.username}"
|
| 617 |
+
caption_text = (
|
| 618 |
+
f"🔥 <b>New Premium Viral Video Leaked!</b> 🔞\n\n"
|
| 619 |
+
f"🎬 <b>Watch HD Video Here:</b>\n"
|
| 620 |
+
f"👉 <b><a href='{bot_link}'>▶️ Click Here to Watch</a></b>\n\n"
|
| 621 |
+
f"🎁 <b>App এর ভেতর 'Secret Box' ওপেন করে Premium Channel Claim করুন!</b> 👇"
|
| 622 |
+
)
|
| 623 |
+
group_markup = InlineKeyboardMarkup([
|
| 624 |
+
[InlineKeyboardButton("🎬 Watch Full Video Here 🔞", url=bot_link)],
|
| 625 |
+
[InlineKeyboardButton("🎁 Open Secret Box", url=f"{bot_link}?start=secretbox")]
|
| 626 |
+
])
|
| 627 |
|
| 628 |
await asyncio.sleep(2)
|
| 629 |
await client.copy_message(message.chat.id, src_chat, msg_id, caption=caption_text, reply_markup=group_markup)
|
|
|
|
| 989 |
|
| 990 |
await status_msg.edit_text("⏳ Preparing to broadcast to groups...")
|
| 991 |
if media_type == "video":
|
| 992 |
+
caption_text = (
|
| 993 |
+
f"🔥 <b>New Premium Viral Video Leaked!</b> 🔞\n\n"
|
| 994 |
+
f"🎬 <b>Watch HD Video Here:</b>\n"
|
| 995 |
+
f"👉 <b><a href='{embed_link if is_blur else bot_link}'>▶️ Click Here to Watch</a></b>\n\n"
|
| 996 |
+
f"🎁 <b>App এর ভেতর 'Secret Box' ওপেন করে Premium Channel Claim করুন!</b> 👇"
|
| 997 |
+
)
|
| 998 |
else:
|
| 999 |
+
caption_text = (
|
| 1000 |
+
f"{clean_caption}\n\n🎁 <b>App এর ভেতর 'Secret Box' ওপেন করে Premium Channel Claim করুন!</b> 👇"
|
| 1001 |
+
if clean_caption else
|
| 1002 |
+
f"🔥 <b>New Premium Viral Content!</b> 🔞\n\n🎬 <b>Watch HD Video Here:</b>\n👉 <b><a href='{bot_link}'>▶️ Click Here to Watch</a></b>\n\n🎁 <b>App এর ভেতর 'Secret Box' ওপেন করে Premium Channel Claim করুন!</b> 👇"
|
| 1003 |
+
)
|
| 1004 |
+
|
| 1005 |
+
group_markup = InlineKeyboardMarkup([
|
| 1006 |
+
[InlineKeyboardButton("🎬 Watch Full Video Here 🔞", url=bot_link)],
|
| 1007 |
+
[InlineKeyboardButton("🎁 Open Secret Box", url=f"{bot_link}?start=secretbox")]
|
| 1008 |
+
])
|
| 1009 |
|
| 1010 |
admin_cap = (
|
| 1011 |
f"✅ <b>Upload and Processing Complete!</b>\n\n"
|