README.markdown in chatterbot-0.9.2 vs README.markdown in chatterbot-0.9.3
- old
+ new
@@ -1,40 +1,34 @@
Chatterbot
===========
-Chatterbot is a Ruby library for making bots on Twitter. It is basic
-enough that you can put it into use quickly, but can be used to make
-pretty involved bots. It handles searches, replies and tweets, and has
-a simple blacklist system to help keep you from spamming people who
-don't want to hear from your bot.
+Chatterbot is a Ruby library for making bots on Twitter. It's
+great for rapid development of bot ideas. It handles all of the basic
+Twitter API features -- searches, replies, tweets, retweets, etc. and has
+a simple blacklist/whitelist system to help minimize spam and unwanted
+data.
[![Build Status](https://secure.travis-ci.org/muffinista/chatterbot.png?branch=master)](http://travis-ci.org/muffinista/chatterbot)
-
Features
--------
-* Works via Twitter's OAuth system.
* Handles search queries and replies to your bot
-* Use a simple DSL, or extend a Bot class if you need it
+* Use a simple scripting language, or extend a Bot class if you need it
+* Wraps the Twitter gem so you have access to the entire Twitter API
* Simple blacklistling system to limit your annoyance of users
+* Avoid your bot making a fool of itself by ignoring tweets with
+ certain bad words
+* Basic Streaming API support
* Optionally log tweets to the database for metrics and tracking purposes
-Is Writing Bots a Good Use of My Time?
-======================================
-Quick answer: if you're planning on being spammish on Twitter, you
-should probably find something else to do. If you're planning on
-writing a bot that isn't too rude or annoying, or that expects a
-certain amount of opt-in from users, then you're probably good. I've
-written a blog post about bots on Twitter here:
-http://muffinlabs.com/2012/06/04/the-current-state-of-bots-on-twitter/
-
-
-
Using Chatterbot
================
+**NEW!!** Chatterbot has a [documentation website](http://muffinista.github.io/chatterbot/). It's a work-in-progress.
+
+
Make a Twitter account
----------------------
First thing you'll need to do is create an account for your bot on
Twitter. That's the easy part.
@@ -48,27 +42,43 @@
actual bot.
Write your bot
--------------
-Chatterbot has a very simple DSL inspired by Sinatra and Twibot, an
-earlier Twitter bot framework. Here's an example, based on
-[@dr_rumack](http://twitter.com/#!/Dr_Rumack), an actual bot running
-on Twitter:
+A bot using chatterbot can be as simple as this:
- require 'chatterbot/dsl'
- search("'surely you must be joking'") do |tweet|
- reply "@#{tweet_user(tweet)} I am serious, and don't call me Shirley!", tweet
- end
+```
+exclude "http://"
+blacklist "mean_user, private_user"
-Or, you can create a bot object yourself, extend it if needed, and use it like so:
+puts "checking my timeline"
+home_timeline do |tweet|
+ # i like to favorite things
+ favorite tweet
+end
+puts "checking for replies to my tweets and mentions of me"
+replies do |tweet|
+ text = tweet.text
+ puts "message received: #{text}"
+ src = text.gsub(/@echoes_bot/, "#USER#")
+
+ # send it back!
+ reply src, tweet
+end
+```
+
+Or you can write a bot using more traditional ruby classes, extend it if needed, and use it like so:
+
bot = Chatterbot::Bot.new
bot.search("'surely you must be joking'") do |tweet|
bot.reply "@#{tweet_user(tweet)} I am serious, and don't call me Shirley!", tweet
end
+Chatterbot can actually generate a template bot file for you, and will
+walk you through process of getting a bot authorized with Twitter.
+
That's it!
Chatterbot uses the the Twitter gem
(https://github.com/sferik/twitter) to handle the underlying API
calls. Any calls to the search/reply methods will return
@@ -91,10 +101,16 @@
reply "#USER# Thanks for contacting me!", tweet
end
Note that the string #USER# will be replaced with the username of the person who sent the original tweet.
+**home_timeline** -- This call will return tweets from the bot's home timeline -- this will include tweets from accounts the bot follows, as well as the bot's own tweets:
+ home_timeline do |tweet|
+ puts tweet.text # this is the actual tweeted text
+ favorite tweet # i like to fave tweets
+ end
+
**tweet** -- send a Tweet out for this bot:
tweet "I AM A BOT!!!"
**reply** -- reply to another tweet:
@@ -312,16 +328,11 @@
Copyright/License
-----------------
-Copyright (c) 2013 Colin Mitchell. Chatterbot is distributed under a
-modified WTFPL licence -- it's the 'Do what the fuck you want to --
-but don't be an asshole' public license. Please see LICENSE.txt for
-further details. Basically, do whatever you want with this code, but
-don't be an asshole about it. If you spam users inappropriately,
-expect your karma to suffer.
-
+Copyright (c) 2014 Colin Mitchell. Chatterbot is distributed under the
+WTFPL licence -- Please see LICENSE.txt for further details.
http://muffinlabs.com