This commit is contained in:
Flummi 2017-11-24 22:36:13 +01:00
parent 06915ce3e7
commit f8d42a3f01
2 changed files with 20 additions and 2 deletions

View File

@ -51,7 +51,7 @@ module.exports = client => {
if (this.server.user.hasi(msg.params[1])) { if (this.server.user.hasi(msg.params[1])) {
tmpuser = this.server.user.geti(msg.params[1]); tmpuser = this.server.user.geti(msg.params[1]);
if (tmpuser.channels) if (tmpuser.channels)
tmpchan = tmpuser.channels; tmpchan = new Map(tmpuser.channels);
} }
let chans = msg.params[2].trim().split(" "); let chans = msg.params[2].trim().split(" ");
for (let chan in chans) { for (let chan in chans) {
@ -71,3 +71,21 @@ module.exports = client => {
this.server.user.set(msg.params[1], tmpuser); this.server.user.set(msg.params[1], tmpuser);
}.bind(client)); }.bind(client));
}; };
Map.prototype.hasi = function (val) {
for (let [key] of this)
if (key.toLowerCase() === val.toLowerCase())
return true;
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);
};

View File

@ -14,7 +14,7 @@ module.exports = bot => {
bot._trigger.set("parser", { bot._trigger.set("parser", {
call: /https?:\/\/[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?/gi, call: /https?:\/\/[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?/gi,
level: 0, level: 0,
active: true, active: false,
clients: ["irc"], clients: ["irc"],
f: e => { f: e => {
const links = e.message.match(/https?:\/\/[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?/gi); const links = e.message.match(/https?:\/\/[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?/gi);