This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function irc(nickname, server, chan, onmsg, onjoin) { | |
nickname = nickname || "nick_" + new Date().getTime().toString(36) + new Date().getMilliseconds().toString(36) | |
chan = chan || "Z" + new Date().getTime().toString(18) + Math.random().toString(36).substring(2) | |
server = server || "irc.unrealircd.org" | |
var init = 0 | |
var ws = new WebSocket("wss://" + server); | |
var s = (c,l)=>setTimeout(console.log.bind(this, "%c%s", "font-size: 14px; color:" + c, new Date().toLocaleString("it") + ": " + l)) | |
ws.onmessage = m=>{ | |
if (m.data.indexOf("PING") == 0) | |
ws.send(m.data.replace("PI", "PO")); |