from telegram import Update
from telegram.ext import Application, MessageHandler, filters, ContextTypes

# Put your bot token from BotFather here
BOT_TOKEN = ""

# Function to respond to text messages
async def auto_reply(update: Update, context: ContextTypes.DEFAULT_TYPE):
    user_text = update.message.text  # The text message sent by the user
    reply_text = f"Thank you for your message! You wrote: {user_text}"
    
    # Send the reply
    await update.message.reply_text(reply_text)

if __name__ == "__main__":
    # Create the application
    app = Application.builder().token(BOT_TOKEN).build()

    # Add a handler for text messages to reply automatically
    app.add_handler(MessageHandler(filters.TEXT & ~filters.COMMAND, auto_reply))

    # Start the bot
    app.run_polling()