Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

An easy DSL for creating Google Talk bots in Ruby

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 examples
Octocat-spinner-32 lib
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 MIT-LICENSE
Octocat-spinner-32 README.textile
Octocat-spinner-32 Rakefile
Octocat-spinner-32 VERSION.yml
Octocat-spinner-32 easy-gtalk-bot.gemspec
README.textile

easy-gtalk-bot

A very easy tool for creating Google Talk bots

It’s really easy!

Installation

sudo gem install easy-gtalk-bot

Usage

Getting online

require 'easy-gtalk-bot'

bot = GTalk::Bot.new(:email => "easy.bot@gmail.com", :password => 'sekrit')
bot.get_online

On invitation

bot.on_invitation do |inviter|
  puts "I have been invited by #{inviter}. Yay!"

  # do something useful

  bot.accept_invitation(inviter)
  bot.message(inviter, "Hello there! Thanks for invitation!")
end

On message

bot.on_message do |from, text|
  puts "I got message from #{from}: '#{text}'"

  # do something useful

  bot.message from, "I heard that!"
end

Going infinite

# 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('john.smith@gmail.com').available?

bot.contact_list # => Array

bot.in_contact_list?('john.smith@gmail.com')

Copyright © 2010 Daniel Vartanov, released under the MIT license

Something went wrong with that request. Please try again.