import telebot from fastapi import FastAPI, Request import uvicorn # Replace with your bot token and externally set webhook URL TOKEN = "6655373829:AAGduLdLyNx7zUtxH73Sp3Z1vHKS35tV9WU" WEBHOOK_URL = "https://astraos-testing.hf.space/webhook" bot = telebot.TeleBot(TOKEN, parse_mode="HTML") # Define your bot handlers as usual: @bot.message_handler(commands=['start']) def handle_start(message): bot.reply_to(message, "Hello! This is a webhook-only Telebot running with FastAPI.") @bot.message_handler(func=lambda message: True) def echo_all(message): bot.reply_to(message, f"You said: {message.text}") if __name__ == '__main__': # Run the webhook listener. # Since you already set up the webhook externally, this call only # listens for incoming updates at the given URL path. bot.run_webhooks( listen='127.0.0.1', # IP address to listen on port=443, # Port to listen on (HTTPS) url_path='webhook', # The URL path part (i.e. /webhook) webhook_url=WEBHOOK_URL, # Your externally set webhook URL certificate=None, # (Optional) Path to SSL certificate file certificate_key=None, # (Optional) Path to the certificate key file max_connections=40, # (Optional) Maximum simultaneous connections allowed_updates=None, # (Optional) List of update types you want your bot to receive ip_address=None, # (Optional) Fixed IP address to use for webhook requests drop_pending_updates=False, # (Optional) Drop any pending updates on startup timeout=20, # (Optional) Request connection timeout in seconds secret_token=None, # (Optional) Secret token for verifying webhook requests secret_token_length=20 # (Optional) Length of the secret token (default: 20) )