Created
January 16, 2012 21:59
-
-
Save patricksrobertson/1623246 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'uri' | |
class IoraBot::Hangout < IoraBot::Observer | |
def matcher | |
/^(hangout|standup)(.*)$/mi | |
end | |
def handle(message, match_data) | |
person = message[:user][:name].split(' ')[0] | |
command = match_data[1] | |
if command == 'standup' | |
reply = "All: time for standup: #{link('iora_standup')}" | |
else | |
room_name = match_data[2].strip | |
room_name = 'iora general discussion' if room_name.empty? | |
reply = "#{person}, here's your hangout link: #{link(room_name)}" | |
end | |
respond(message, reply) | |
end | |
def link(room_name) | |
"https://talkgadget.google.com/hangouts/extras/iorahealth.com/#{URI.encode(room_name)}?authuser=0&hl=en&eid" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment