百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
C

chatterbot

> 编程语言
开源

一个基于 Ruby 的简洁的 Twitter Bot 框架,使用 OAuth 进行身份验证。

490 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

一个基于 Ruby 的简洁的 Twitter Bot 框架,使用 OAuth 进行身份验证。

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 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Ruby

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

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