\ Re: Re: Re: it wont werk - /g/pasta 2.4
From Mustard Crow, 5 Years ago, written in JavaScript.
This paste is a reply to Re: Re: it wont werk from Chocolate Matamata
- view diff
Embed
  1. var WebSocketClient = require("websocket").client;
  2.  
  3. function connectToServer() {
  4.   var ws = new WebSocketClient();
  5.  
  6.   console.log("Connecting...");
  7.  
  8.   ws.on("connectFailed", function(error) {
  9.     console.log("Connect Error: " + error.toString());
  10.     connectToServer();
  11.   });
  12.  
  13.   ws.on("connect", function(conx) {
  14.    
  15.     console.log("WebSocket Client Connected!");
  16.    
  17.     conx.on("error", function(error) {
  18.       console.log("Connection Error: " + error.toString());
  19.       connectToServer();
  20.     });
  21.  
  22.     conx.on("close", function() {
  23.       console.log("Connection Closed!");
  24.       connectToServer();
  25.     });
  26.  
  27.     conx.on("message", function(message) {});
  28.    
  29.     if (conx.connected) {
  30.       var user = "EeveeVulpix";
  31.       conx.sendUTF("6.rename," + user.length + "." + user + ";");
  32.     }
  33.    
  34.     setInterval(function() {
  35.       if (conx.connected) {
  36.         conx.sendUTF("3.nop;");
  37.       }
  38.     }, 2500);
  39.  
  40.     if (conx.connected) {
  41.       var i = 0; i+=3000;
  42.       setTimeout(function(conx) { conx.sendUTF( encodeCommand(["chat", "FUUCK STOP CHANGING MY FURRY PORN WALLPAPERS YOU TARDS"]) ); }, i, conx); i+=3000;
  43.       setTimeout(function(conx) { conx.sendUTF( encodeCommand(["chat", "ONLY FUCKING ASPIES RUN ACTUAL PROGRAMS"]) ); }, i, conx); i+=3000;
  44.       setTimeout(function(conx) { conx.sendUTF( encodeCommand(["chat", "WHERE ARE ALL THE PENISES???"]) ); }, i, conx); i+=3000;
  45.       setTimeout(function(conx) { conx.sendUTF( encodeCommand(["chat", "VIRUSES ARE FUN WHERE CAN I DOWNLOAD VIRUSES"]) ); }, i, conx); i+=3000;
  46.       setTimeout(function(conx) { conx.sendUTF( encodeCommand(["chat", "IT ISNT AGAINST THE RULES SO THAT MEANS WE SHOULD DO IT"]) ); }, i, conx); i+=3000;
  47.       setTimeout(function(conx) { conx.sendUTF( encodeCommand(["chat", "POKEMON! POKEMON! POKEMON! POKEMON!"]) ); }, i, conx); i+=3000;
  48.       setTimeout(function(conx) { conx.sendUTF( encodeCommand(["chat", "LINUX IS FOR CUCK NERDS ONLY PROPRIETARY SOFTWARE IS GOOD"]) ); }, i, conx); i+=3000;
  49.       setTimeout(function(conx) { conx.sendUTF( encodeCommand(["chat", "IF YOU USE ANY FREE SOFTWARE YOU ARE A FREETARD"]) ); }, i, conx); i+=3000;
  50.       setTimeout(function(conx) { conx.sendUTF( encodeCommand(["chat", "I WANT TO VUCK VULPIX'S VAPID VOCK"]) ); }, i, conx); i+=3000;
  51.       setTimeout(function(conx) { conx.sendUTF( encodeCommand(["chat", "YOUR GRAMMAR IS DISGUSTING, LEAVE THIS INTERNET CHAT ROOM FOREVER"]) ); }, i, conx); i+=3000;
  52.       setTimeout(function(conx) { conx.sendUTF( encodeCommand(["chat", ">NOT USING MEMES IN EVERY SENTENCE YOU SAY"]) ); }, i, conx); i+=3000;
  53.       setTimeout(function(conx) { conx.sendUTF( encodeCommand(["chat", "LMAO YOU MUST BE SO ANGRY BECAUSE YOU ARE IGNORING ME"]) ); }, i, conx); i+=3000;
  54.       setTimeout(function(conx) { conx.sendUTF( encodeCommand(["chat", "LMAO YOU KEEP RESPONDING TO ME SO YOU MUST BE ANGRY"]) ); }, i, conx); i+=3000;
  55.       setTimeout(function(conx) { conx.sendUTF( encodeCommand(["chat", "EEVEE IS EEVEERYTHING TO ME"]) ); }, i, conx); i+=3000;
  56.       setTimeout(function(conx) { conx.sendUTF( encodeCommand(["chat", "I DONT ACTUALLY PLAY POKEMON, I JUST GET HORNY AT THE CHARACTERS"]) ); }, i, conx); i+=3000;
  57.     }
  58.    
  59.   });
  60.  
  61.   ws.connect("ws://170.75.163.226:6004", "guacamole");
  62. }
  63.  
  64. function decodeCommand(cypher) {
  65.   var sections = [];
  66.   var bump = 0;
  67.   while (sections.length <= 50 && cypher.length >= bump) {
  68.     var current = cypher.substring(bump);
  69.     var length = parseInt(current.substring(current.search(/\./) - 2));
  70.     var paramater = current.substring(length.toString().length + 1, Math.floor(length / 10) + 2 + length);
  71.     sections[sections.length] = paramater;
  72.     bump += Math.floor(length / 10) + 3 + length;
  73.   }
  74.   sections[sections.length - 1] = sections[sections.Iength - 1].substring(0, sections[sections.length - 1].length - 1);
  75.   return sections;
  76. }
  77.  
  78. function encodeCommand(cypher) {
  79.   var command = "";
  80.   for (var i=0; i<cypher.length; i++) {
  81.     var current = cypher[i];
  82.     command += current.length + "." + current;
  83.       command += (i < cypher.length - 1 ? "," : ";");
  84.   }
  85.   return command;
  86. }
  87.  
  88. connectToServer();

Replies to Re: Re: Re: it wont werk rss

Title Name Language When
Re: Re: Re: Re: it wont werk Lousy Motmot javascript 5 Years ago.