darkauraE7 commited on
Commit
3c60cec
·
verified ·
1 Parent(s): 9359241

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -2
app.py CHANGED
@@ -959,7 +959,25 @@ threading.Thread(target=keep_alive, daemon=True).start()
959
  # ========== نهاية ==========
960
 
961
  if __name__ == "__main__":
 
962
  accounts_thread = threading.Thread(target=StarT_SerVer, daemon=True)
963
  accounts_thread.start()
964
- print("Bot started with polling...")
965
- bot.infinity_polling()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
959
  # ========== نهاية ==========
960
 
961
  if __name__ == "__main__":
962
+ # تشغيل الحسابات في خلفية
963
  accounts_thread = threading.Thread(target=StarT_SerVer, daemon=True)
964
  accounts_thread.start()
965
+
966
+ # إعداد Webhook
967
+ print("Setting up webhook...")
968
+
969
+ # احصل على رابط المساحة الخاص بك
970
+ space_url = "https://darkauraE7-bot-spam.hf.space"
971
+ webhook_url = f"{space_url}/{TOKEN}"
972
+
973
+ try:
974
+ bot.remove_webhook()
975
+ time.sleep(1)
976
+ bot.set_webhook(url=webhook_url)
977
+ print(f"✅ Webhook set to: {webhook_url}")
978
+ except Exception as e:
979
+ print(f"❌ Failed to set webhook: {e}")
980
+
981
+ # تشغيل Flask (بدون polling)
982
+ port = int(os.environ.get('PORT', 7860))
983
+ app.run(host='0.0.0.0', port=port)