forked from GitHub/dbot
Fix for the Identica bit by allowing a name argument to be passed [#344]
This commit is contained in:
parent
5d30261770
commit
0f298bd061
@ -66,8 +66,8 @@ var dent = function(dbot) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(s in this.StatusRegex) {
|
for(s in this.StatusRegex) {
|
||||||
dbot.api.link.addHandler(this.StatusRegex[s], function(event, matches) {
|
dbot.api.link.addHandler(s, this.StatusRegex[s], function(event, matches, name) {
|
||||||
this.lookup(event, matches[1], s);
|
this.lookup(event, matches[1], name);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}
|
}
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
@ -33,8 +33,12 @@ var link = function(dbot) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.api = {
|
this.api = {
|
||||||
'addHandler': function(regex, handler) {
|
'addHandler': function(name, regex, handler) {
|
||||||
this.handlers.push({ 'regex': regex, 'callback': handler });
|
this.handlers.push({
|
||||||
|
'name': name,
|
||||||
|
'regex': regex,
|
||||||
|
'callback': handler
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -111,7 +115,7 @@ var link = function(dbot) {
|
|||||||
for(var i=0;i<this.handlers.length;i++) {
|
for(var i=0;i<this.handlers.length;i++) {
|
||||||
var matches = this.handlers[i].regex.exec(urlMatches[0]);
|
var matches = this.handlers[i].regex.exec(urlMatches[0]);
|
||||||
if(matches) {
|
if(matches) {
|
||||||
this.handlers[i].callback(event, matches);
|
this.handlers[i].callback(event, matches, this.handlers[i].name);
|
||||||
handlerFound = true; break;
|
handlerFound = true; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user