Tinatra - Ruby powered DSL, which a designed for making twitter bots.

Tinatra is a DSL for making twitter bots. It's like Sinatra. トゥィナトラ.

Feature

  • Easy to make twitter bot
  • Run in cron
  • Many actions (always,mention,direct_message,followed,timeline,...)
  • Automatic follow return/remove return

Install

gem install tinatra

http://rubygems.org/gems/tinatra

Usage

require 'tinatra'

timeline do |tweet|
  p tweet #=> New tweet in timeline
end

mention do |m|
  p m #=> New tweet in mention
end

direct_message do |dm|
  p dm #=> New Direct message
end

followed do |user|
  p user #=> New user who is followed
end

removed do |user|
  p user #=> User removed
end

always do
  # Always run
  p api.class #=> OAuthRubytter
  api.update("hi")
end

Setup

$ ruby a.rb --db=/path/to/db --init
------------ AUTHORIZING ------------
Input your consumer key: CONSUMERKEY
Input your consumer secret: PSSSSST

Access This URL and press 'Allow' in account for tinatra => http://...
Input key shown by twitter: 0000000

Authorizing is done.
$ ruby a.rb --db=/path/to/db

Database

$ ruby a.rb --db=...

db "..."

set :db, "..."

License

The MIT Licence

(c) Shota Fukumori (sora_h) 2010-

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.