def process_color_step(message):
chat_id = message.chat.id
product.color = message.text
msg = bot.send_message(chat_id, 'ok, send me a photo of your phone')
bot.register_next_step_handler(msg,process_image_step)
def process_image_step(message):
chat_id = message.chat.id
product.image = message.photo[1].file_id
msg = bot.send_message(chat_id, 'Ok, send me a description of your phone?')
bot.register_next_step_handler(msg,process_description_step)
Above is snippets of the code. The image file_id is passed on to product.image.
2
Answers
I would use an image library to try to load the file. Something like pillow would do the trick.
You can use message handler as a list of handlers. for example in your conversation handler:
In this case if user update isn’t photo, first MessageHandler for getting photo is not acceptable so handler try to catch next MessageHandler in the list:
you have to define a function to response to user wrong entry and put it in second element of handlers list.