google bot

A Chat bot is completely automated, that is online 24×7 and will always send & respones to your requests, just like a virtual friend. You can do lot of interesting stuff  like receive alert notifications, post to twitter, book tickets, set reminders, write blogs, and so much more.
Now the reason I am specifically looking at GTalk here is, coz its on open standards - XMPP !!

The Solution: We will write a basic chat bot which will change its status message on our command, using an Opensource Framework PYGtalkRobot.Later, you can expand the idea to more complex tasks like posting to twitter or checking emails etc..

Requirements:

-- Geeky mindset, with basic language skills of python.

-- Linux server running Centos with SSH access

-- 2 Gtalk user accounts.

 

Lets, Get Started..

Step 1: Install Python - 2.4 and above

 

view plaincopy to clipboardprint?
yum install python  
Step 2: Download and unpack xmpppy.

wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz
tar zxvf setuptools-0.6c11.tar.gz
cd setuptools-0.6c11
python setup.py build
python setup.py install

To install it go into the unpacked directory and run:

view plaincopy to clipboardprint?
python setup.py install  

Step 3: Download and unpack pydns.

To install it go into the unpacked directory and run:

view plaincopy to clipboardprint?
python setup.py install  
 

Step 4: Next, Checkout the source code for pygtalkrobot from SVN server:

view plaincopy to clipboardprint?
svn checkout http://pygtalkrobot.googlecode.com/svn/trunk/pygtalkrobot/src pygtalkrobot-read-only  
Step 5: Setup the Bot

 The pygtalktrobot directory contains the file:'sampleRobotcode.py".In this file, edit the following lines:

Change the following lines as below:

view plaincopy to clipboardprint?
--  if jid == 'ldmiao@gmail.com': to  'ldmiao@gmail.com' to your gtalk id, so that this bot recognizes you as the admin.  
  
  
--  bot.start("account_name@gmail.com", "password")  to "account_name@gmail.com" & "password" to your second gtalk account details through which the bot will login.  
Step 6: Run the sampleRobot

view plaincopy to clipboardprint?
python sampleRobotcode.py  
Your sample bot should start running now, and the status should show connected.

 

Step 7: Add the gtalk bot user as a friend in your Gtalk Messenger.

Gtalk bot will automatically accept you as a friend.

 

Step 8: Once added, send the command "online GTalk Bot".

This will change the status message of the bot to "GTalk Bot". Hurray!! Your own bot is ready and it responds to the commands..
Comments