README.markdown in chatterbot-2.0.0.pre vs README.markdown in chatterbot-2.0.2
- old
+ new
@@ -1,8 +1,13 @@
Chatterbot
===========
+Hey! This is Chatterbot 2.0. There have been some breaking changes
+from older versions of the library, and it doesn't support MySQL
+anymore. If you are looking for the old version,
+you can try the [1.0 branch](https://github.com/muffinista/chatterbot/tree/1.0.2)
+
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.
@@ -49,11 +54,11 @@
A bot using chatterbot can be as simple as this:
```
exclude "http://"
-blacklist "mean_user, private_user"
+blocklist "mean_user, private_user"
puts "checking my timeline"
home_timeline do |tweet|
# i like to favorite things
favorite tweet
@@ -69,18 +74,19 @@
reply src, tweet
end
```
Or you can write a bot using more traditional ruby classes, extend it if needed, and use it like so:
-
- class MyBot < Chatterbot::Bot
+```
+ class MyBot < Chatterbot::Bot
def do_stuff
search("'surely you must be joking'") do |tweet|
reply "@#{tweet_user(tweet)} I am serious, and don't call me Shirley!", tweet
end
end
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!
@@ -99,19 +105,19 @@
to do something complicated, you should probably consider using the
[Twitter gem](https://github.com/sferik/twitter#streaming) directly.
Basic usage is very straightforward:
- streaming true
+ use_streaming true
home_timeline do |tweet|
puts "someone i follow tweeted! #{tweet.text}"
end
You can also run a search:
- streaming true
+ use_streaming true
search("pizza") do |tweet|
puts "someone is talking about pizza! #{tweet.text}"
end
@@ -165,25 +171,25 @@
**retweet** -- Chatterbot can retweet tweets as well:
```rb
search "xyzzy" do |tweet|
- retweet(tweet[:id])
+ retweet(tweet.id)
end
```
**direct_message** -- send a DM to a user:
direct_message "I am a bot sending you a direct message", user
(NOTE: you'll need to make sure your bot has permission to send DMs)
-**blacklist** -- you can use this to specify a list of users you don't
+**blocklist** -- you can use this to specify a list of users you don't
want to interact with. If you put the following line at the top of
your bot:
- blacklist "user1, user2, user3"
+ blocklist "user1, user2, user3"
None of those users will trigger your bot if they come up in a
search. However, if a user replies to one of your tweets or mentions
your bot in a tweet, you will receive that tweet when calling the
reply method.
@@ -305,11 +311,11 @@
```rb
loop do
search "twitter" do |tweet|
# here you could do something with a tweet
# if you want to retweet
- retweet(tweet[:id])
+ retweet(tweet.id)
end
replies do |tweet|
# do stuff
end
@@ -317,20 +323,20 @@
sleep 60
end
```
-Blacklists
+Blocklists
----------
Not everyone wants to hear from your bot. To keep annoyances to a
-minimum, Chatterbot has a simple blacklist tool. Using it is as simple as:
+minimum, Chatterbot has a simple blocklist tool. Using it is as simple as:
- blacklist "mean_user, private_user"
+ blocklist "mean_user, private_user"
You should really respect the wishes of users who don't want to hear
-from your bot, and add them to your blacklist whenever requested.
+from your bot, and add them to your blocklist whenever requested.
There's also an 'exclude' method which can be used to add
words/phrases you might want to ignore -- for example, if you wanted
to ignore tweets with links, you could do something like this:
@@ -346,10 +352,10 @@
I can work with you on that.
Copyright/License
-----------------
-Copyright (c) 2015 Colin Mitchell. Chatterbot is distributed under the
+Copyright (c) 2016 Colin Mitchell. Chatterbot is distributed under the
MIT licence -- Please see LICENSE.txt for further details.
http://muffinlabs.com