parser fix lul

This commit is contained in:
Flummi 2018-11-11 06:40:21 +01:00
parent 49ec286bb9
commit 14b918b8af

View File

@ -85,17 +85,15 @@ export class irc extends EventEmitter {
this.send( msgmodes[mode].replace("{recipient}", recipient).replace("{msg}", e) ); this.send( msgmodes[mode].replace("{recipient}", recipient).replace("{msg}", e) );
}); });
} }
parse(data, [a, ...b] = data.split(/ +:/)) { parse(data, [a, ...b] = data.split(/ +:/), tmp = a.split(" ").concat(b)) {
let tmp = a.split(" ").concat(b); logger.debug(`(${this.network}) in: ${data}`);
logger.debug(`(${this.network}) in: ${[...tmp]}`); let prefix = data.charAt(0) === ":" ? tmp.shift() : null
return data.charAt(0) === ":" ? { , command = tmp.shift()
prefix: tmp.shift(), , params = command.toLowerCase() === "privmsg" ? [ tmp.shift(), tmp.join(" :") ] : tmp;
command: tmp.shift(), return {
params: [tmp.shift(), tmp.join(" :")] prefix: prefix,
} : { command: command,
prefix: null, params: params
command: tmp.shift(),
params: [tmp.shift(), tmp.join(" :")]
}; };
} }
reply(tmp) { reply(tmp) {
@ -138,8 +136,8 @@ export class irc extends EventEmitter {
whois(user, force = false) { whois(user, force = false) {
user = user.toLowerCase(); user = user.toLowerCase();
let tmpuser = {}; let tmpuser = {};
if(this.server.user.hasi(user) && !force) { if(this.server.user.has(user) && !force) {
tmpuser = this.server.user.geti(user); tmpuser = this.server.user.get(user);
if(tmpuser.cached >= ~~(Date.now() / 1000) - this._recachetime) if(tmpuser.cached >= ~~(Date.now() / 1000) - this._recachetime)
return; return;
} }
@ -178,7 +176,7 @@ export class irc extends EventEmitter {
} }
} }
Map.prototype.hasi = function(val) { /*Map.prototype.hasi = function(val) {
for (let [key] of this) for (let [key] of this)
if(key.toLowerCase() === val.toLowerCase()) if(key.toLowerCase() === val.toLowerCase())
return true; return true;
@ -194,4 +192,4 @@ Map.prototype.deli = function(val) {
for (let [key] of this) for (let [key] of this)
if(key.toLowerCase() === val.toLowerCase()) if(key.toLowerCase() === val.toLowerCase())
this.delete(key); this.delete(key);
}; };*/