Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if event in 'Change':
- url = values['url']
- game = values['status']
- import websocket
- for i in tknlines:
- ws = websocket.WebSocket()
- if status == "Random":
- stat = ['online', 'dnd', 'idle']
- status = random.choice(stat)
- ws.connect('wss://gateway.discord.gg/?v=6&encoding=json')
- hello = json.loads(ws.recv())
- heartbeat_interval = hello['d']['heartbeat_interval']
- if values['type1'] == "Playing":
- gamejson = {
- "name": game,
- "type": 0
- }
- elif values['type1'] == 'Streaming':
- gamejson = {
- "name": game,
- "type": 1,
- "url": url
- }
- elif values['type1'] == "Listening to":
- gamejson = {
- "name": game,
- "type": 2
- }
- elif values['type1'] == "Watching":
- gamejson = {
- "name": game,
- "type": 3
- }
- auth = {
- "op": 2,
- "d": {
- "token": i,
- "properties": {
- "$os": sys.platform,
- "$browser": "Ya boi Anonymous",
- "$device": f"{sys.platform} Device"
- },
- "presence": {
- "game": gamejson,
- "status": status,
- "since": 0,
- "afk": False
- }
- },
- "s": None,
- "t": None
- }
- ws.send(json.dumps(auth))
- ack = {
- "op": 1,
- "d": None
- }
- while True:
- time.sleep(heartbeat_interval/1000)
- try:
- ws.send(json.dumps(ack))
- except Exception:
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement