oh, handler was checking existence of matches[2] for some stupid reason [Close #353]

This commit is contained in:
reality 2013-04-13 15:41:13 +00:00
parent 8a2dd076a4
commit 8151122b80

View File

@ -77,15 +77,15 @@ var imgur = function(dbot) {
this.onLoad = function() { this.onLoad = function() {
var imgurHandler = function(event, matches, name) { var imgurHandler = function(event, matches, name) {
if(matches[2]) { // TODO: handle this in the regex if(matches[1]) {
this.api.getImageInfo(matches[1], function(imgData) { this.api.getImageInfo(matches[1], function(imgData) {
var info = this.internalAPI.infoString(imgData); var info = this.internalAPI.infoString(imgData);
if(info) event.reply(info); if(info) event.reply(info);
}.bind(this)); }.bind(this));
} }
}.bind(this); }.bind(this);
dbot.api.link.addHandler(this.name, /http:\/\/i\.imgur\.com\/([a-zA-Z0-9]+)\.([jpg|png|gif])/, imgurHandler); dbot.api.link.addHandler(this.name, /https?:\/\/i\.imgur\.com\/([a-zA-Z0-9]+)\.([jpg|png|gif])/, imgurHandler);
dbot.api.link.addHandler(this.name, /\bhttps?:\/\/imgur\.com\/([a-zA-Z0-9]+)\b/i, imgurHandler); dbot.api.link.addHandler(this.name, /https?:\/\/imgur\.com\/([a-zA-Z0-9]+)/, imgurHandler);
}.bind(this); }.bind(this);
}; };