Skip to content

Commit

Permalink
handled no songlink case
Browse files Browse the repository at this point in the history
  • Loading branch information
epai committed Mar 31, 2016
1 parent 889c149 commit 9a934d3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions functions/songlinkify.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ module.exports.action = function(api, message, cb) {
request(targetUrl + link, function(err, res, body) {
if (!err && res.statusCode === 200) {
var data = JSON.parse(body);
var frankie_msg = String.format("{0} - {1}: {2}" + Array(30).join(" "),
if (data['songlink'] !== '') {
var frankie_msg = String.format("{0} - {1}: {2}" + Array(30).join(" "),
data['artists'][0], data['title'], data['songlink']);
api.sendMessage(frankie_msg, message.threadID);
api.sendMessage(frankie_msg, message.threadID);
}
}
});
}
Expand Down

0 comments on commit 9a934d3

Please sign in to comment.