def sender(id, text=None, attachments=None):
vk_session.method('messages.send',
{'user_id': id, 'message': text, 'random_id': 0, 'attachment': attachments})
for event in longpoll.listen():
print(event.type)
if event.type == VkBotEventType.MESSAGE_NEW:
if len(event.object.message['attachments']) != 0:
if event.object.message['attachments'][0]['type'] == 'photo':
OwnerIdPhoto = event.object.message['attachments'][0]['photo']['owner_id']
IdPhoto = event.object.message['attachments'][0]['photo']['id']
AccessKeyPhoto = event.object.message['attachments'][0]['photo']['access_key']
id = event.object.message['from_id']
sender(id, text="Photo", attachments=f"photo{IdPhoto}_{OwnerIdPhoto}_{AccessKeyPhoto}")
def sender(id, text=None, attachments=None):
vk_session.method('messages.send',
{'user_id': id, 'message': text, 'random_id': 0, 'attachment': attachments})
for event in longpoll.listen():
print(event.type)
if event.type == VkBotEventType.MESSAGE_NEW:
if len(event.object.message['attachments']) != 0:
if event.object.message['attachments'][0]['type'] == 'photo':
OwnerIdPhoto = event.object.message['attachments'][0]['photo']['owner_id']
IdPhoto = event.object.message['attachments'][0]['photo']['id']
AccessKeyPhoto = event.object.message['attachments'][0]['photo']['access_key']
id = event.object.message['from_id']
sender(id, text="Photo", attachments=f"photo-{IdPhoto}_{OwnerIdPhoto}_{AccessKeyPhoto}")