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.exclude -- similarly, you can specify a list of words/phrases which shouldn't trigger your bot.If you find yourself pushing the limits of Chatterbot, it's very possible that you should just be using the Twitter gem directly.Chatterbot has some basic support for the Streaming API.and has a simple blacklist/whitelist system to help minimize spam and unwanted data. reply src, 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. Chatterbot uses the the Twitter gem ( to handle the underlying API calls.Any calls to the search/reply methods will return Twitter:: Status objects, which are basically extended hashes. If you are looking for the old version, you can try the 1.0 branch Chatterbot is a Ruby library for making bots on Twitter. It handles all of the basic Twitter API features -- searches, replies, tweets, retweets, etc. A bot using chatterbot can be as simple as this: exclude " blocklist "mean_user, private_user" 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 = puts "message received: #{text}" src = text.gsub(/@echoes_bot/, "#USER#") # send it back! There have been some breaking changes from older versions of the library, and it doesn't support My SQL anymore. First thing you'll need to do is create an account for your bot on Twitter. Chatterbot comes with a script named which will handle two tasks -- it will authorize your bot with Twitter and it will generate a skeleton script, which you use to implement your actual bot.

If you put the following line at the top of your bot: None of those users will trigger your bot if they come up in a search.This is an experimental feature but should work for most purposes. If you want to do something not provided by the DSL, you have access to an instance of Twitter:: Client provided by the client method.If you want to do something complicated, you should probably consider using the Twitter gem directly.Basic usage is very straightforward: Note that the string #USER# will be replaced with the username of the person who sent the original tweet.


If you use the following: Any tweets or mentions with the word 'spam' in them will be ignored by the bot.If you wanted to ignore any tweets with links in them (a wise precaution if you want to avoid spreading spam), you could call: followers -- get a list of your followers.


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>