Skip to content
Prev Previous commit
Next Next commit
fixed dadJoke error
  • Loading branch information
James Taber authored and James Taber committed May 22, 2018
commit 60ec9843be118aadb71f68682708b84c94a2f5f1
3 changes: 2 additions & 1 deletion bot/controllers/games.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ class GamesController extends BaseController {
};
fetch('https://icanhazdadjoke.com/', options)
.then(res => res.text())
.then(body => message.reply(`Here is your joke ${message.author.username}!! ${body}`));
.then(body => message.channel.send(`Here is your joke ${message.author.username}!! ${body}`));
return 'Want to hear a joke?';
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible solution to this would be to use async / await for the fetch, that way the reply waits for the joke to return before posting.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the function is already an async function

Expand Down