Twitter Bot is a simple interface to twitter using xmpp4r to take advantage of the Twitter jabber interface.
sudo gem install twitter_bot
Twitter Bot comes with a generator that will get your project up and running easily with Twitter. There are only a few items that need to be modified and you will be on your way to having an awesome Twitter application!
Demonstration of usage
From your project directory run:
ruby script/generate twitter_bot <name>
First, modify the config/twitter_bot.yml file with your Twitter username/password and your Jabber ID/password. Additionally, add phrase to track on Twitter.
Next, modify the lib/<name>_twitter_bot.rb file to specify the action to take when a tweet/follow/unfollow message is received. The default action for receiving a tweet is to log the message. The default action for receiving a follow message is to follow the user back and send a direct message. The default action for an unfollow is to log that the user is no longer following the Twitter user specified in the config/twitter_bot.yml file. Customize these in whatever way you see fit.
Don’t forget to require the twitter_bot gem in your project.
That’s it, you’re ready to go with Twitter integrated into your app. Just run the following command to start the bot:
ruby script/twitter_bot start
To stop the bot use:
ruby script/twitter_bot stop
How to submit patches
Read the 8 steps for fixing other people’s code.
The trunk repository is
svn://rubyforge.org/var/svn/integrum/twitter_bot for anonymous access.
You can fetch the source from:
- rubyforge: http://rubyforge.org/scm/?group_id=4341
This code is free to use under the terms of the MIT license.
Comments are welcome. Send an email to Integrum