input.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # GPL3 or later
  2. # Program to have manual input from the computer
  3. import os
  4. import json
  5. import time
  6. from ui import *
  7. import youtube
  8. from getpass import getpass
  9. import commands
  10. signed = ""
  11. while True:
  12. c = input(clr["tbgr"]+signed+": "+clr["norm"])
  13. username = signed
  14. with open('stuff.json') as json_file:
  15. stuff = json.load(json_file)
  16. if not c and not username:
  17. continue
  18. if not username and c and "@" not in c:
  19. print(" Login first!")
  20. continue
  21. # Login
  22. elif c.startswith("@"):
  23. if c in stuff.get("users", {}):
  24. if stuff.get("users", {}).get(c, {}).get("password"):
  25. password = getpass("Password: ")
  26. if password != stuff.get("users", {}).get(c, {}).get("password"):
  27. print("Wrong Password!")
  28. continue
  29. signed = c
  30. elif signed and not c:
  31. signed = ""
  32. else:
  33. answer = commands.execute(username, c)
  34. print(" [ "+clr["tbbu"]+"SENDING"+clr["norm"]+" ] "+answer.replace("\n", "\n "))