Guest User

Untitled

a guest
Oct 21st, 2019
57
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def send_file(mess, to_id):
  2. img = mess['attachments']
  3. img2 = img[0]
  4. type_messages = img2['type']
  5. img3 = img2[type_messages]
  6. img4 = str(img3['owner_id'])
  7. img5 = str(img3['id'])
  8. if (type_messages == 'photo') or (type_messages == 'video') or (type_messages == 'doc'):
  9. img6 = str(img3['access_key'])
  10. else:
  11. img6 = ('')
  12. if img6 != "":
  13. type_mess = type_messages + img4 + '_' + img5 + '_' + img6
  14. else:
  15. type_mess = type_messages + img4 + '_' + img5
  16. print(to_id,type_mess)
  17. api.messages.send(user_id=to_id, attachment=type_mess, random_id=random.randint(10 ** 8, 10 ** 10))
RAW Paste Data