mirror of
https://github.com/reality/dbot.git
synced 2024-12-28 21:52:38 +01:00
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) {
|
||||
dbot.api.link.addHandler(this.StatusRegex[s], function(event, matches) {
|
||||
this.lookup(event, matches[1], s);
|
||||
dbot.api.link.addHandler(s, this.StatusRegex[s], function(event, matches, name) {
|
||||
this.lookup(event, matches[1], name);
|
||||
}.bind(this));
|
||||
}
|
||||
}.bind(this);
|
||||
|
@ -33,8 +33,12 @@ var link = function(dbot) {
|
||||
};
|
||||
|
||||
this.api = {
|
||||
'addHandler': function(regex, handler) {
|
||||
this.handlers.push({ 'regex': regex, 'callback': handler });
|
||||
'addHandler': function(name, regex, 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++) {
|
||||
var matches = this.handlers[i].regex.exec(urlMatches[0]);
|
||||
if(matches) {
|
||||
this.handlers[i].callback(event, matches);
|
||||
this.handlers[i].callback(event, matches, this.handlers[i].name);
|
||||
handlerFound = true; break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user