Answer the question
In order to leave comments, you need to log in
The message is not sent, what should I do?
token = "."
vk = vk_api.VkApi(token = token )
vk._auth_token()
easygui.msgbox("бот запущен", "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() == "привет":
vk.method("messages.send", {"peer_id": id, "message": "приветствую", "random_id": random.randint(1, 2147483647)})
elif body.lower() == "новосибирск":
vk.method("messages.send", {"peer_id": id, "message": div.text, "random_id": random.randint(1, 2147483647)})
elif body.lower() == "доллар":
vk.method("messages.send", {"peer_id": id, "message": span_dollar.text, "random_id": random.randint(1, 2147483647)})
elif body.lower() == "коронавирус":
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": "Не понял тебя!", "random_id": random.randint(1, 2147483647)})
vk.method("messages.send", {"peer_id": id, "message": "команды: погода, город, доллар", "random_id": random.randint(1, 2147483647)})
except Exception as E:
time.sleep(1)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question