Update bot.py
Browse files
bot.py
CHANGED
|
@@ -37,17 +37,18 @@ class RequestHandler(BaseHTTPRequestHandler):
|
|
| 37 |
# تشغيل السيرفر على المنفذ 7860 المطلوب من HF
|
| 38 |
Thread(target=lambda: HTTPServer(('0.0.0.0', 7860), RequestHandler).serve_forever(), daemon=True).start()
|
| 39 |
|
| 40 |
-
# --- 3. إعدادات الحساب ---
|
| 41 |
API_ID = int(os.environ.get("API_ID", 0))
|
| 42 |
API_HASH = os.environ.get("API_HASH", "")
|
| 43 |
SESSION_STRING = os.environ.get("SESSION_STRING", "")
|
| 44 |
TARGET_CHAT = int(os.environ.get("TARGET_CHAT", 0))
|
| 45 |
|
| 46 |
app = Client(
|
| 47 |
-
"
|
| 48 |
api_id=API_ID,
|
| 49 |
api_hash=API_HASH,
|
| 50 |
session_string=SESSION_STRING,
|
|
|
|
| 51 |
max_concurrent_transmissions=1 # تقليل الضغط على سيرفرات تيليجرام
|
| 52 |
)
|
| 53 |
|
|
@@ -130,7 +131,7 @@ async def restricted_bypass_worker():
|
|
| 130 |
# --- 7. التشغيل ---
|
| 131 |
async def main():
|
| 132 |
await app.start()
|
| 133 |
-
print("🚀 البوت يعمل الآن بكفاءة على Hugging Face!")
|
| 134 |
|
| 135 |
asyncio.create_task(restricted_bypass_worker())
|
| 136 |
asyncio.create_task(scan_old_history())
|
|
|
|
| 37 |
# تشغيل السيرفر على المنفذ 7860 المطلوب من HF
|
| 38 |
Thread(target=lambda: HTTPServer(('0.0.0.0', 7860), RequestHandler).serve_forever(), daemon=True).start()
|
| 39 |
|
| 40 |
+
# --- 3. إعدادات الحساب (تحديث الذاكرة المؤقتة لمنع التضارب) ---
|
| 41 |
API_ID = int(os.environ.get("API_ID", 0))
|
| 42 |
API_HASH = os.environ.get("API_HASH", "")
|
| 43 |
SESSION_STRING = os.environ.get("SESSION_STRING", "")
|
| 44 |
TARGET_CHAT = int(os.environ.get("TARGET_CHAT", 0))
|
| 45 |
|
| 46 |
app = Client(
|
| 47 |
+
"memory_session", # تم تغيير الاسم لتجنب الملفات القديمة
|
| 48 |
api_id=API_ID,
|
| 49 |
api_hash=API_HASH,
|
| 50 |
session_string=SESSION_STRING,
|
| 51 |
+
in_memory=True, # 👈 الحل الجذري لمنع تعارض الجلسات في Docker
|
| 52 |
max_concurrent_transmissions=1 # تقليل الضغط على سيرفرات تيليجرام
|
| 53 |
)
|
| 54 |
|
|
|
|
| 131 |
# --- 7. التشغيل ---
|
| 132 |
async def main():
|
| 133 |
await app.start()
|
| 134 |
+
print("🚀 البوت يعمل الآن بكفاءة عالية على Hugging Face بذاكرة مؤقتة!")
|
| 135 |
|
| 136 |
asyncio.create_task(restricted_bypass_worker())
|
| 137 |
asyncio.create_task(scan_old_history())
|