Skip to content

Commit

Permalink
Show artwork as icon in slack
Browse files Browse the repository at this point in the history
  • Loading branch information
uiur committed Aug 28, 2015
1 parent d80cb2d commit e894000
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,21 @@ function notify (track, music) {
}

if (process.env.SLACK_WEBHOOK_URL) {
postToSlack(messageForSlack(track, music))
postToSlack(messageForSlack(track, music), music, track)
}
}

function postToSlack (message) {
function postToSlack (message, music, track) {
music = music || {}
var webhookUrl = process.env.SLACK_WEBHOOK_URL
var username = 'playing ' + track.artist

return fetch(webhookUrl, {
method: 'post',
body: JSON.stringify({
text: message
text: message,
username: username,
icon_url: music.artworkUrl60
})
})
}
Expand Down

0 comments on commit e894000

Please sign in to comment.