from telegram.ext import Updater, MessageHandler, Filters
# Define a function to handle incoming messages
def echo(update, context):
# Get the text message sent by the user
message = update.message.text
# Send the same message back to the user
context.bot.send_message(chat_id=update.effective_chat.id, text=message)
# Create an updater and pass your bot's token
updater = Updater("YOUR_BOT_TOKEN")
# Get the dispatcher to register handlers
dispatcher = updater.dispatcher
# Register the echo function as a handler for text messages
dispatcher.add_handler(MessageHandler(Filters.text, echo))
# Start polling for incoming updates
updater.start_polling()