A
A
apiwi2020-11-03 18:35:35
Python
apiwi, 2020-11-03 18:35:35

How to make a condition in vk_api condition?

I want to do something like a test, I don’t understand how to make a condition in a condition?

Schematically: If User wrote "Start", then catch his answer YES or NO.

for event in self.longpoll.listen():
                    if event.type == VkEventType.MESSAGE_NEW and event.to_me:
                        id = event.user_id
                        msg = event.text.lower()
                        if msg == 'начать':
                            self.write_msg(id, "Хочешь начать тест?")
                            if msg == 'да':
                                self.write_msg(id, "Хорошо.")
                            
                            elif msg == "нет":
                                self.write_msg(id, "Понял.")
                                
                        elif msg == "команды":
                            pass

                        elif msg == "стоп":
                            pass

                        else:
                            self.write_msg(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