1. إعداد السيرفر الوهمي لإبقاء البوت يعمل (Keep Alive)
app = Flask('')
@app.route('/')
def home():
return "البوت يعمل الآن 24/7 ✅"
def run():
app.run(host='0.0.0.0', port=8080)
def keep_alive():
t = Thread(target=run)
t.start()
2. إعدادات بوت تليجرام
TOKEN = 'ضع_التوكن_هنا' # احصل عليه من @Botfather
bot = telebot.TeleBot(TOKEN)
@bot.message_handler(commands=['start'])
def start(message):
bot.reply_to(message, "أهلاً! أنا بوتك الشغال 24 ساعة بدون توقف 🚀")
@bot.message_handler(func=lambda message: True)
def echo(message):
bot.reply_to(message, f"وصلتني رسالتك: {message.text}")
3. تشغيل السيرفر والبوت معاً
if name == "main":
keep_alive() # تشغيل خدعة الاستيقاظ
print("جاري تشغيل البوت...")
bot.infinity_polling()