From c08e7ad100a48d44d912ff4db0fdbf090d692ca4 Mon Sep 17 00:00:00 2001 From: Zach Holman Date: Mon, 7 Nov 2011 16:13:53 -0800 Subject: [PATCH] star songs --- src/scripts/play.coffee | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/scripts/play.coffee b/src/scripts/play.coffee index 20b354df2..d2158b965 100644 --- a/src/scripts/play.coffee +++ b/src/scripts/play.coffee @@ -94,6 +94,7 @@ module.exports = (robot) -> return if message.match[1] == 'stats' return if message.match[1].split(' ')[0] == 'song' return if message.match[1].split(' ')[0] == 'album' + return if message.match[1].split(' ')[0] == 'something' message.http("#{URL}/add_artist") .query(user_login: message.message.user.githubLogin, artist_name: message.match[1]) .post() (err, res, body) -> @@ -126,6 +127,20 @@ module.exports = (robot) -> else message.send("Never heard of it.") + robot.respond /(I like|star) this song/i, (message) -> + message.http("#{URL}/star_now_playing") + .query(user_login: message.message.user.githubLogin) + .post() (err, res, body) -> + json = JSON.parse(body) + message.send("You have a weird taste in music, but I'll remember it.") + + robot.respond /play something i('d)? like/i, (message) -> + message.http("#{URL}/play_stars") + .query(user_login: message.message.user.githubLogin) + .post() (err, res, body) -> + json = JSON.parse(body) + message.send("Queued up " + json.song_title + " by " + json.artist_name) + robot.respond /I want this song/i, (message) -> message.http("#{URL}/now_playing").get() (err, res, body) -> json = JSON.parse(body)