Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
C

chatterbot

> 编程语言
Open source

A straightforward ruby-based Twitter Bot Framework, using OAuth to authenticate.

490 stars0 likes2 views
WebsiteGitHub

About

A straightforward ruby-based Twitter Bot Framework, using OAuth to authenticate.

Chatterbot

Hi friends, I'm finally archiving this project as of March 2023. I really enjoyed using and maintaining Chatterbot, and I hope it was helpful for other people too. ❤️

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

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. Features

  • Handles search queries and replies to your bot
  • 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 blocklist system to limit your annoyance of users
  • Avoid your bot making a fool of itself by ignoring tweets with certain bad words

Using Chatterbot

Chatterbot has a documentation website. It's a work-in-progress. You can also read the gem documentation.

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.

Run the generator

Chatterbot comes with a script named chatterbot-register 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.

Write your bot

A bot using chatterbot can be as simple as this:

exclude "http://"
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 = 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:

…

rb loop do search "twitter" do |tweet| # here you could do something with a tweet # if you want to retweet retweet(tweet.id) end

replies do |tweet| # do stuff end

sleep 60 end


Blocklists
----------

Not everyone wants to hear from your bot.  To keep annoyances to a
minimum, Chatterbot has a simple blocklist tool. Using it is as simple as:

    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 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:

    exclude "http://"

Contributing to Chatterbot
--------------------------

Pull requests for bug fixes and new features are eagerly accepted.
Since this code is based off of actual Twitter bots, please try and
maintain compatability with the existing codebase. If you are
comfortable writing a spec for any changed code, please do so. If not,
I can work with you on that.

Copyright/License
-----------------

Copyright (c) 2018 Colin Mitchell. Chatterbot is distributed under the
MIT licence -- Please see LICENSE.txt for further details.

http://muffinlabs.com

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Ruby

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言