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

twitter_ebooks

> 编程语言
Open source

Better twitterbots for all your friends~

965 stars0 likes1 views
WebsiteGitHub

About

Better twitterbots for all your friends~

Unmaintained

The Twitter social environment is a bit different than it was when I originally wrote this, and Twitter has deprecated the streaming API on which the ebooks bots depend. I've moved on to other projects, but feel free to fork!

twitter_ebooks

A framework for building interactive twitterbots which respond to mentions/DMs. See ebooks_example for a fully-fledged bot definition.

New in 3.0

  • About 80% less memory and storage use for models
  • Bots run in their own threads (no eventmachine), and startup is parallelized
  • Bots start with ebooks start, and no longer die on unhandled exceptions
  • ebooks auth command will create new access tokens, for running multiple bots
  • ebooks console starts a ruby interpreter with bots loaded (see Ebooks::Bot.all)
  • Replies are slightly rate-limited to prevent infinite bot convos
  • Non-participating users in a mention chain will be dropped after a few tweets
  • API documentation and tests

Note that 3.0 is not backwards compatible with 2.x, so upgrade carefully! In particular, make sure to regenerate your models since the storage format changed.

Installation

Requires Ruby 2.1+. Ruby 2.3+ is recommended.

bash
gem install twitter_ebooks

Setting up a bot

Run ebooks new to generate a new repository containing a sample bots.rb file, which looks like this:

ruby
# This is an example bot definition with event handlers commented out
# You can define and instantiate as many bots as you like

class MyBot  model = Ebooks::Model.load("model/0xabad1dea.model")
> model.make_statement(140)
=> "My Terrible Netbook may be the kind of person who buys Starbucks, but this Rackspace vuln is pretty straight up a backdoor"
> model.make_response("The NSA is coming!", 130)
=> "Hey - someone who claims to be an NSA conspiracy"

The secondary function is the "interesting keywords" list. For example, I use this to determine whether a bot wants to fav/retweet/reply to something in its timeline:

ruby
top100 = model.keywords.take(100)
tokens = Ebooks::NLP.tokenize(tweet.text)

if tokens.find { |t| top100.include?(t) }
  favorite(tweet)
end

Bot niceness

twitter_ebooks will drop bystanders from mentions for you and avoid infinite bot conversations, but it won't prevent you from doing a lot of other spammy things. Make sure your bot is a good and polite citizen!

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 推出的简洁高效系统语言