def main():
try:
for event in longpoll.listen():
if event.type == VkEventType.MESSAGE_NEW:
if event.to_me:
id = event.user_id
if event.attachments:
if event.attachments["attach1_type"] == "sticker":
sender(id, "Я не могу воспринимать стикеры :(\nНо я знаю id того стика - {}.".format(
event.attachments["attach1"]))
elif event.attachments["attach1_type"] == "photo":
print("Это фото!")
item_url = ""
max_i = 0
items = vk.messages.getById(message_ids=event.message_id)
txt = items["items"][0]["text"]
for i in items["items"][0]["attachments"][0]["photo"]["sizes"]:
if i["height"] > max_i:
max_i = i["height"]
item_url = i["url"]
print(item_url)