diff --git a/modules/link/link.js b/modules/link/link.js index 6c987f6..e9e1c7f 100644 --- a/modules/link/link.js +++ b/modules/link/link.js @@ -39,9 +39,7 @@ var link = function(dbot) { request("http://xkcd.com/info.0.json", function(error, response, body){ if (response.statusCode == "200") { data = JSON.parse(body); - comicId = data.num; - comicId = (Math.floor(Math.random() * comicId) + 1); - event.params[1] = comicId; + event.params[1] = (Math.floor(Math.random() * data.num) + 1); dbot.commands['~xkcd'](event); } });