A
A
Arthur2018-06-12 15:11:48
Python
Arthur, 2018-06-12 15:11:48

Single query command to write Vk_api messages. How to solve infinite loop?

Hello everyone. I am creating a bot for VK. It is necessary to register the command, the logic so that the user first writes the command itself in this case / info, and only then the recording starts.
1.user writes /info
2.Writes subsequent messages
3.If the user no longer needs to write /stop
The problem is that this bot will not be able to exit the while loop, since there is no access to new messages, so it is difficult to make some input () through VK api, and through VK api it is not clear how to request a new message

if message == "/info":
   while message != "/stop":
       a = message[:-1]
        file = ["Откуда,Куда,Состояние".split(","),a.split("/")]
        my_list = []
        fieldnames = file[0]
       for values in file[1:]:
            inner_dict = dict(zip(fieldnames, values))
            my_list.append(inner_dict)
            
            print(surname(my_list,fieldnames))
                                shutil.copy("test1.csv", "copyTest1.csv")
                                print(user_id)
                                print(response)
                                print(response['updates'][z][5])
else:
pack = response['updates'][z]
createanswer(pack)
print(api.messages.send(user_id=str(user_id), message="test"))
.

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