Better twitterbots for all your friends~
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!
A framework for building interactive twitterbots which respond to mentions/DMs. See ebooks_example for a fully-fledged bot definition.
ebooks start, and no longer die on unhandled exceptionsebooks auth command will create new access tokens, for running multiple botsebooks console starts a ruby interpreter with bots loaded (see Ebooks::Bot.all)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.
Requires Ruby 2.1+. Ruby 2.3+ is recommended.
gem install twitter_ebooksRun ebooks new to generate a new repository containing a sample bots.rb file, which looks like this:
# 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:
top100 = model.keywords.take(100)
tokens = Ebooks::NLP.tokenize(tweet.text)
if tokens.find { |t| top100.include?(t) }
favorite(tweet)
endtwitter_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!
No open issues yet, or sync has not completed.