Python
- 8 ответов
- 0 вопросов
6
Вклад в тег
attachments = ""
for i in event.raw['object']['attachments']:
attachments1 = i['type']
try:
attach = attachments1 + str(i[attachments1]['owner_id']) + '_' + str(i[attachments1]['id']) + '_' + str(i[attachments1]['access_key']) + ','
attachments += attach
except:
attach = attachments1 + str(i[attachments1]['owner_id']) + '_' + str(i[attachments1]['id']) + ','
attachments += attach
vk.method('messages.send', {'peer_id': event.object.peer_id, 'message': event.object.text[5:], 'attachment': attachments, 'random_id': 0})
attachments = []
eventAttachments = event.raw['object']['attachments']
for attachment in eventAttachments:
attach = "%s%s_%s" % (attachment['type'], attachment['owner_id'], attachment['id'])
if 'access_key' in attachment:
attach += "_%s" % attachment['access_key']
attachments.append(attach)
vk.method('messages.send', {'peer_id': event.object.peer_id, 'message': event.object.text[5:], 'attachment': ','.join(attachments), 'random_id': 0})