P
P
ProooNoob2021-11-15 12:28:51
Python
ProooNoob, 2021-11-15 12:28:51

How to validate user input in telegram bot?

I welcome everyone! Tell me how to implement user input validation in python? Preferably with the telebot library. Most of all, the conditions that are met when receiving a picture / photograph are of interest.

Let me show you a code example:

def step(message): #тут наверное что-то другое будет
    try:
        if #пользователь ввёл текст
           pass
        if #пользователь ввёл цифры
           pass
        if #пользователь отправил картинку/фото
           pass
        if #пользователь отправил документ
           pass
    except Exception as e:
        bot.send_message(message.chat.id, 'Ошибка')

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question