Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def send_file(mess, to_id):
- img = mess['attachments']
- img2 = img[0]
- type_messages = img2['type']
- img3 = img2[type_messages]
- img4 = str(img3['owner_id'])
- img5 = str(img3['id'])
- if (type_messages == 'photo') or (type_messages == 'video') or (type_messages == 'doc'):
- img6 = str(img3['access_key'])
- else:
- img6 = ('')
- if img6 != "":
- type_mess = type_messages + img4 + '_' + img5 + '_' + img6
- else:
- type_mess = type_messages + img4 + '_' + img5
- print(to_id,type_mess)
- api.messages.send(user_id=to_id, attachment=type_mess, random_id=random.randint(10 ** 8, 10 ** 10))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement