SHARE
TWEET

ws.ts

Donovan_DMC Nov 4th, 2019 (edited) 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import WebSocket from "ws";
  2. import * as os from "os";
  3.  
  4. // this code is NOT how libraries do it, there is MUCH more to this, the gateway url must be fetched every time you launch a client, shards are automatically spawned, not manually filled in, etc
  5. const ws = new WebSocket("wss://gateway.discord.gg?v=6");
  6. ws
  7.     .on("message", (m) => {
  8.         console.log(m.toString());
  9.  
  10.         ws.send(JSON.stringify({
  11.             op: 2,
  12.             d: {
  13.                 token: "as if",
  14.                 properties: {
  15.                     $os: os.type(),
  16.                     $browser: "OwO",
  17.                     $device: "OwO"
  18.                 },
  19.                 compress: false,
  20.                 shard: [0, 1]
  21.             }
  22.         }));
  23.     })
  24.     .on("error", (e) => console.error(e))
  25.     .on("close", (e, r) => console.error("Unclean WS Close: %s %s", e, r));
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top