Skip to content

Commit

Permalink
Small oversight fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Remco authored and Remco committed Mar 11, 2016
1 parent 336b42b commit 39ba575
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions runtime/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -1074,6 +1074,12 @@ Commands.yomomma = {
var request = require('request');
request('http://api.yomomma.info/', function(error, response, body) {
if (!error && response.statusCode == 200) {
try {
JSON.parse(body);
} catch (e) {
bot.sendMessage(msg, 'The API returned an unconventional response.');
return;
}
var yomomma = JSON.parse(body);
bot.reply(msg, yomomma.joke);
} else {
Expand Down

0 comments on commit 39ba575

Please sign in to comment.