I'm making a telegram bot which asks user different questions and I need to save their answers into variables.
@bot.message_handler(commands=['addproduct'])
def handle_text(message):
bot.send_message(message.chat.id, "Price =")
Then a user answers and a program should save an answer into a variable price.
How do I save a message from the user into a variable?
@bot.message_handler(commands=['addproduct'])
def handle_text(message):
cid = message.chat.id
msgPrice = bot.send_message(cid, 'Set your price:')
bot.register_next_step_handler(msgPrice , step_Set_Price)
def step_Set_Price(message):
cid = message.chat.id
userPrice= message.text
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.