User:ThePokegeek5000/AutoChat

import('https://cdnjs.cloudflare.com/ajax/libs/msgpack-lite/0.1.26/msgpack.min.js') .then(e => {   console.log('yes');  }) .catch(e => {   console.log('error', e);  });

var socket = null; WebSocket.prototype.oldSend = WebSocket.prototype.send; WebSocket.prototype.send = function(m) { this.oldSend(m); if (!socket) { socket = this; } };

// socket.send(msgpack.encode(['ch', ['HEY HEY HEY']]));

const messages = { 1: 'So is your face, u noob', 2: "You're such a noob....", 3: 'Have a happy life!! ...not! :)', 4: "I've seen bigger noobs. NOT!",  5: "Don't u just love unicorns? :)", 6: 'Hey little noob!', };

const chat = function(id) { socket.send(msgpack.encode(['ch', [messages[id]]])); };

window.addEventListener('keypress', e => { console.log('you pressed: ', e.which);

switch (e.which) { case 91: chat(1); break; case 92: chat(2); break; case 93: chat(3); break; case 96: chat(4); break; case 46: chat(5); break; case 44: chat(6); break; default: } });