Skip to content

Instantly share code, notes, and snippets.

@bcardarella
Forked from patricksrobertson/hangout.rb
Created January 17, 2012 08:00
Show Gist options
  • Save bcardarella/1625554 to your computer and use it in GitHub Desktop.
Save bcardarella/1625554 to your computer and use it in GitHub Desktop.
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