d=[]
for event in longpol.listen():
if event.type == VkEventType.MESSAGE_NEW:
if event.to_me:
messages = vk_session.method("messages.getConversations", {"offset": 0, "count": 20, "filter": "unanswered"})
id = messages["items"][0]["last_message"]["from_id"]
msg = messages["items"][0]["last_message"]["text"]
if msg == "2":
d.append(id)