L
L
Loknut2022-02-07 08:11:38
Bots
Loknut, 2022-02-07 08:11:38

How to create a psychological test on a telegram bot?

Please tell me what the bot is based on, which has the following structure: The
bot asks sequential questions, saying what do you like to do, how old are you, and so on. (I know what register_next_step_handler is used for)
And depending on the answers, it displays a certain text, i.e. if you answered that you are 0 years old and you like to play - one text, and if you are 0 years old and you like to sing - already another. Like in psychological tests or something.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
LXSTVAYNE, 2022-02-07
@lxstvayne

In fact, to create quizzes (successive questions and answers), you need to use state machines. In your library it is implemented like this: An example from off. documentation .

I
InternetMaster, 2022-02-07
@InternetMaster

Well, let's start with the fact that you did not specify the library, but you can understand that you have PyTelegramBotAPI bot.register_next_step_handlerand the total complexity of the issue.
I think you may not have heard of the comparison operator seriously.

def lala(message):
    if kolvoLet == 0: # На самом деле, можно и не делать, если возраст не привязан к ответам, просто в вопросе было 0 лет
        if chtoTamUTebya == 'любишь играть':
            pass # Здесь соответственно на «любишь играть»
        elif chtoTamUTebya == 'любишь петь':
            pass # Здесь соответственно на «любишь петь»
        # И попер так дальше по всем вариантам.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question