iSoFe commited on
Commit
a5ae39f
·
verified ·
1 Parent(s): d0c4cfb

Update bot.py

Browse files
Files changed (1) hide show
  1. bot.py +7 -7
bot.py CHANGED
@@ -60,16 +60,16 @@ async def handle_file(client: Client, message: Message):
60
  # If user wants 2GB, we really should stream.
61
 
62
  # Let's try direct streaming pipe
63
- form = aiohttp.FormData()
64
- form.add_field('file', file_generator(), filename=file_name)
 
65
 
66
  async with aiohttp.ClientSession() as session:
67
- await status_msg.edit("🚀 جاري الرفع إلى Nekoo.ru...")
68
- async with session.post("https://nekoo.ru/api/upload", data=form) as response:
69
  if response.status == 200:
70
- data = await response.json()
71
- if data.get("status") == "success":
72
- url = data.get("url")
73
  await status_msg.edit(
74
  f"✅ **تم الرفع!**\n\n"
75
  f"📄 **الملف:** `{file_name}`\n"
 
60
  # If user wants 2GB, we really should stream.
61
 
62
  # Let's try direct streaming pipe
63
+ form = aiohttp.FormData()
64
+ form.add_field('reqtype', 'fileupload')
65
+ form.add_field('fileToUpload', file_generator(), filename=file_name)
66
 
67
  async with aiohttp.ClientSession() as session:
68
+ await status_msg.edit("🚀 جاري الرفع إلى Catbox...")
69
+ async with session.post("https://catbox.moe/user/api.php", data=form) as response:
70
  if response.status == 200:
71
+ url = await response.text() # Catbox يرجع الرابط كنص مباشر
72
+ if url.startswith("http"):
 
73
  await status_msg.edit(
74
  f"✅ **تم الرفع!**\n\n"
75
  f"📄 **الملف:** `{file_name}`\n"