3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-27 22:39:26 +01:00

Added check for params[1] to ~xkcd

This commit is contained in:
Daniel Dowling 2013-01-31 17:20:51 +00:00
parent 451b7ea4d0
commit 4b7c2092b0

View File

@ -34,7 +34,10 @@ var link = function(dbot) {
}, },
'~xkcd': function(event) { '~xkcd': function(event) {
var comicId = event.params[1]; var comicId;
if(!_.isUndefined(event.params[1])) {
comicId = event.params[1];
}
if(comicId == "*"){ if(comicId == "*"){
request("http://xkcd.com/info.0.json", function(error, response, body){ request("http://xkcd.com/info.0.json", function(error, response, body){
if (response.statusCode == "200") { if (response.statusCode == "200") {
@ -59,6 +62,7 @@ var link = function(dbot) {
} }
}); });
} }
}, },
'~ud': function(event) { '~ud': function(event) {