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