Python 使用电报机器人,您如何在两条连续消息的情况下执行指定代码?

Python 使用电报机器人,您如何在两条连续消息的情况下执行指定代码?,python,telegram,telegram-bot,Python,Telegram,Telegram Bot,我想让聊天机器人复制用户以“repeat”的形式发送的消息,然后复制用户发送的消息 import telegram from telegram.ext import Updater, CommandHandler from telegram.ext import MessageHandler, Filters token = "" # I wrote this id = "" # I wrote this bot = telegram.Bot(token

我想让聊天机器人复制用户以“
repeat
”的形式发送的消息,然后复制用户发送的消息

import telegram
from telegram.ext import Updater, CommandHandler
from telegram.ext import MessageHandler, Filters

token = "" # I wrote this
id = "" # I wrote this
bot = telegram.Bot(token)
bot.sendMessage(chat_id=id, text="Start")

def send_text(text):
    bot.send_message(chat_id=id, text=text)

updater = Updater(token=token, use_context=True)
dispatcher = updater.dispatcher
updater.start_polling()

def handler(update, context):
    user_text = update.message.text
    if user_text == "repeat":       # ???
        if user_text == ""          # ???
        send_text()                 # ???

echo_handler = MessageHandler(Filters.text, handler)
dispatcher.add_handler(echo_handler)