easy-gtalk-bot
A very easy tool for creating Google Talk bots
It’s really easy!
Installation
sudo gem install easy-gtalk-bot
Usage
require 'easy-gtalk-bot'
bot = GTalk::Bot.new(:email => "[email protected]", :password => 'sekrit')
bot.get_online
bot.on_invitation do |inviter|
puts "I have been invited by #{inviter}. Yay!"
# do something useful
bot.accept_invitation(inviter)
bot.(inviter, "Hello there! Thanks for invitation!")
end
bot. do |from, text|
puts "I got message from #{from}: '#{text}'"
# do something useful
bot. from, "I heard that!"
end
# Don't be confused with the name of this method.
# We actually keep the current (main) thread alive while letting listener thread to do its job.
# So we have no need to set up an any infinite loop.
Thread.stop
To-do
bot.get_online :invisible => true
bot.set_status :away
GTalk::Account('[email protected]').available?
bot.contact_list # => Array
bot.in_contact_list?('[email protected]')
Copyright © 2010 Daniel Vartanov, released under the MIT license