comment getLevel function
add Map prototype functions to irc lib
This commit is contained in:
parent
3a895eda83
commit
d2d9ef70a5
|
@ -100,10 +100,10 @@ export class irc extends EventEmitter {
|
||||||
user: Object.assign(this.parsePrefix(tmp.prefix), {
|
user: Object.assign(this.parsePrefix(tmp.prefix), {
|
||||||
account: this.server.user.geti(this.parsePrefix(tmp.prefix).nick).account,
|
account: this.server.user.geti(this.parsePrefix(tmp.prefix).nick).account,
|
||||||
prefix: tmp.prefix.charAt(0) === ":" ? tmp.prefix.substring(1) : tmp.prefix,
|
prefix: tmp.prefix.charAt(0) === ":" ? tmp.prefix.substring(1) : tmp.prefix,
|
||||||
level: getLevel(this.network, Object.assign(this.parsePrefix(tmp.prefix), {
|
/*level: getLevel(this.network, Object.assign(this.parsePrefix(tmp.prefix), {
|
||||||
account: this.server.user.geti(this.parsePrefix(tmp.prefix).nick).account,
|
account: this.server.user.geti(this.parsePrefix(tmp.prefix).nick).account,
|
||||||
prefix: tmp.prefix.charAt(0) === ":" ? tmp.prefix.substring(1) : tmp.prefix
|
prefix: tmp.prefix.charAt(0) === ":" ? tmp.prefix.substring(1) : tmp.prefix
|
||||||
}))
|
}))*/
|
||||||
}),
|
}),
|
||||||
message: tmp.params[1].replace(/\u0002/, ""),
|
message: tmp.params[1].replace(/\u0002/, ""),
|
||||||
time: ~~(Date.now() / 1000),
|
time: ~~(Date.now() / 1000),
|
||||||
|
|
|
@ -11,6 +11,31 @@ import welcome from "./welcome";
|
||||||
import who from "./who";
|
import who from "./who";
|
||||||
import whois from "./whois";
|
import whois from "./whois";
|
||||||
|
|
||||||
|
Map.prototype.hasi = function(val) {
|
||||||
|
try {
|
||||||
|
for (let [key] of this)
|
||||||
|
if(key.toLowerCase() === val.toLowerCase())
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
} catch(err) {
|
||||||
|
console.log("das übliche mit tolowercase()");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Map.prototype.geti = function(val) {
|
||||||
|
for (let [key, value] of this)
|
||||||
|
if(key.toLowerCase() === val.toLowerCase())
|
||||||
|
return value;
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
Map.prototype.deli = function(val) {
|
||||||
|
for (let [key] of this)
|
||||||
|
if(key.toLowerCase() === val.toLowerCase())
|
||||||
|
this.delete(key);
|
||||||
|
};
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
cap, invite, join,
|
cap, invite, join,
|
||||||
motd, msg, nick,
|
motd, msg, nick,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user