OBMEN.py 948 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. from telethon import sync, events
  2. import time
  3. from telethon import TelegramClient
  4. import sqlite3
  5. db = sqlite3.connect('Account.db', timeout=30)
  6. cur = db.cursor()
  7. cur.execute(f"SELECT API_ID FROM Account WHERE ID = '{1}'")
  8. api_id = str(cur.fetchone()[0])
  9. time.sleep(1)
  10. cur.execute(f"SELECT API_HASH FROM Account WHERE ID = '{1}'")
  11. api_hash = str(cur.fetchone()[0])
  12. time.sleep(1)
  13. session = "anon31"
  14. client = TelegramClient(session, api_id, api_hash)
  15. client.start()
  16. myself = client.get_me()
  17. k = str(myself.id)
  18. cur.execute(f'UPDATE Account SET MY_ID = ? WHERE ID = ?', (k, 1))
  19. db.commit()
  20. time.sleep(1)
  21. cur.execute(f"SELECT NAME FROM Account WHERE ID = '{1}'")
  22. name = str(cur.fetchone()[0])
  23. print(name)
  24. time.sleep(1)
  25. #entity = client.get_dialogs()
  26. entity = client.get_entity(name)
  27. id_Friend = entity.id
  28. m = str(id_Friend)
  29. print(m)
  30. time.sleep(1)
  31. cur.execute(f'UPDATE Account SET ID_SOB = ? WHERE ID = ?', (m, 1))
  32. db.commit()
  33. time.sleep(1)