balance.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import sqlite3
  2. import time
  3. from telethon import TelegramClient
  4. from telethon import sync, events
  5. import re
  6. import json
  7. db = sqlite3.connect('Account.db')
  8. cur = db.cursor()
  9. x = 1
  10. m = 0
  11. while(True):
  12. if x == 23:
  13. print("Всего добыто:")
  14. print(m)
  15. break
  16. cur.execute(f"SELECT PHONE FROM Account WHERE ID = '{x}'")
  17. time.sleep(0.4)
  18. Phone = str(cur.fetchone()[0])
  19. print("Входим в аккаунт: " + Phone)
  20. cur.execute(f"SELECT API_ID FROM Account WHERE ID = '{x}'")
  21. time.sleep(0.4)
  22. api_id = str(cur.fetchone()[0])
  23. cur.execute(f"SELECT API_HASH FROM Account WHERE ID = '{x}'")
  24. time.sleep(0.4)
  25. api_hash = str(cur.fetchone()[0])
  26. session = str("anon" + str(x))
  27. client = TelegramClient(session, api_id, api_hash)
  28. client.start()
  29. dlgs = client.get_dialogs()
  30. for dlg in dlgs:
  31. if dlg.title == 'LTC Click Bot':
  32. tegmo = dlg
  33. client.send_message('LTC Click Bot', "/balance")
  34. time.sleep(3)
  35. msgs = client.get_messages(tegmo, limit=1)
  36. for mes in msgs:
  37. str_a = str(mes.message)
  38. zz = str_a.replace('Available balance: ', '')
  39. qq = zz.replace(' LTC', '')
  40. print(qq)
  41. waitin = float(qq)
  42. m = m + waitin
  43. #print(m)
  44. x = x + 1
  45. time.sleep(1)