require 'rinda/ring' require 'rinda/tuplespace' require 'timeout' def bot_say msg DRb.start_service ring_server = Rinda::RingFinger.primary if ring_server begin Timeout.timeout(5){ bot = ring_server.read([:name, :BCMBot,nil,nil])[2] bot.say(msg) if bot } rescue Timeout::Error puts "no response from server" end end end if __FILE__ == $0 msg = ARGV[0] || 'hello world' bot_say msg end