Message is not sent, what to do?

token = "."
vk = vk_api.VkApi(token = token )
vk._auth_token()
easygui.msgbox("run bot", "Bot")
while True:
try:
 messages = vk.method("messages.getConversations", {"offset": 0, "count": 20, "filter": "unanswered"})
 if messages["count"] >= 1:
 id = messages["items"][0]["last_message"]["from_id"]
 body = messages["items"][0]["last_message"]["text"]
 if body.lower() == "Hello":
 vk.method("messages.send", {"peer_id": id, "message": "welcome", "random_id": random.randint(1, 2147483647)})
 elif body.lower() == "Novosibirsk":
 vk.method("messages.send", {"peer_id": id, "message": div.text, "random_id": random.randint(1, 2147483647)})
 elif body.lower() == "dollar":
 vk.method("messages.send", {"peer_id": id, "message": span_dollar.text, "random_id": random.randint(1, 2147483647)})
 elif body.lower() == "coronavirus":
 vk.method("messages.send", {"peer_id": id, "message": div_corona.text, "random_id": random.randint(1, 2147483647)})
else:
 vk.method("messages.send", {"peer_id": id, "message": "I do Not understand you!", "random_id": random.randint(1, 2147483647)})
 vk.method("messages.send", {"peer_id": id, "message": "command: weather, city, dollar", "random_id": random.randint(1, 2147483647)}) 
 except Exception as E:
 time.sleep(1)

the message does not read, does not send, before everything worked. (token scril)
April 19th 20 at 12:04
2 answers
April 19th 20 at 12:06
Give permission in the VC group.
Go to:
1) Management: 5e96ab0073735814950398.png
2) work with the API:
5e96ab41e6e76250496940.png
3) Type:
5e96ab6fa3bd5550011162.png
4) 5e96abab76a98270163942.png
5) a resolution:
5e96abc053838366636800.png
And then the resolution? You look at his code, he did not longpoll he uses, and just about every time unread requests. - Lurline12 commented on April 19th 20 at 12:09
April 19th 20 at 12:08
indentation forgot

Find more questions by tags Python