diff --git a/botart.coffee b/botart.coffee index 924c36b..f894bd6 100644 --- a/botart.coffee +++ b/botart.coffee @@ -129,7 +129,21 @@ hear /about/, (message) -> message.say "I am learning to love." hear /help/, (message) -> - message.say "I listen for '@#{username} image me PHRASE' and '@#{username} wiki me PHRASE'" + message.say "I listen for '@#{username} image me PHRASE' and '@#{username} wiki me PHRASE' and '@#{username} weather in PLACE'" + +hear /weather in (.+)/i, (message) -> + place = message.match[1] + url = "http://www.google.com/ig/api?weather=#{escape place}" + + get url, (body) -> + try + console.log body + if match = body.match(/(.+?)<\/current_conditions>/) + icon = match[1].match(/ term = escape(message.match[1])