Update bot.py
Browse files
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 |
-
|
| 64 |
-
form.add_field('
|
|
|
|
| 65 |
|
| 66 |
async with aiohttp.ClientSession() as session:
|
| 67 |
-
await status_msg.edit("🚀 جاري الرفع إلى
|
| 68 |
-
async with session.post("https://
|
| 69 |
if response.status == 200:
|
| 70 |
-
|
| 71 |
-
if
|
| 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"
|