Advertisement
epictroller629

uwu

Jun 17th, 2020
1,016
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.13 KB | None | 0 0
  1.     if event in 'Change':
  2.         url = values['url']
  3.         game = values['status']
  4.         import websocket
  5.         for i in tknlines:
  6.             ws = websocket.WebSocket()
  7.             if status == "Random":
  8.                 stat = ['online', 'dnd', 'idle']
  9.                 status = random.choice(stat)
  10.             ws.connect('wss://gateway.discord.gg/?v=6&encoding=json')
  11.             hello = json.loads(ws.recv())
  12.             heartbeat_interval = hello['d']['heartbeat_interval']
  13.             if values['type1'] == "Playing":
  14.                 gamejson = {
  15.                     "name": game,
  16.                     "type": 0
  17.                 }
  18.             elif values['type1'] == 'Streaming':
  19.                 gamejson = {
  20.                     "name": game,
  21.                     "type": 1,
  22.                     "url": url
  23.                 }
  24.             elif values['type1'] == "Listening to":
  25.                 gamejson = {
  26.                     "name": game,
  27.                     "type": 2
  28.                 }
  29.             elif values['type1'] == "Watching":
  30.                 gamejson = {
  31.                     "name": game,
  32.                     "type": 3
  33.                 }
  34.             auth = {
  35.                 "op": 2,
  36.                 "d": {
  37.                     "token": i,
  38.                     "properties": {
  39.                         "$os": sys.platform,
  40.                         "$browser": "Ya boi Anonymous",
  41.                         "$device": f"{sys.platform} Device"
  42.                     },
  43.                     "presence": {
  44.                         "game": gamejson,
  45.                         "status": status,
  46.                         "since": 0,
  47.                         "afk": False
  48.                     }
  49.                 },
  50.                 "s": None,
  51.                 "t": None
  52.                 }
  53.             ws.send(json.dumps(auth))
  54.             ack = {
  55.                     "op": 1,
  56.                     "d": None
  57.                 }
  58.             while True:
  59.                 time.sleep(heartbeat_interval/1000)
  60.                 try:
  61.                     ws.send(json.dumps(ack))
  62.                 except Exception:
  63.                     break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement