Sha256: 644381a62a003a330e74be2161883722f068f2e354e0285f37227ea572f81611

Contents?: true

Size: 667 Bytes

Versions: 7

Compression:

Stored size: 667 Bytes

Contents

module Chatterbot

  #
  # routines for sending tweets
  module Tweet 
    # simple wrapper for sending a message
    def tweet(txt, params = {}, original = nil)
      return if require_login == false

      txt = replace_variables(txt, original)
      
      if debug_mode?
        debug "I'm in debug mode, otherwise I would tweet: #{txt}"
      else
        debug txt
        log txt, original
        client.update txt, params
      end
    rescue Twitter::Error::Forbidden => e
      debug e
      false
    end

    # reply to a tweet
    def reply(txt, source)
      debug txt
      tweet txt, {:in_reply_to_status_id => source[:id]}, source
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
chatterbot-0.7.1 lib/chatterbot/tweet.rb
chatterbot-0.7.0 lib/chatterbot/tweet.rb
chatterbot-0.6.6 lib/chatterbot/tweet.rb
chatterbot-0.6.5 lib/chatterbot/tweet.rb
chatterbot-0.6.3 lib/chatterbot/tweet.rb
chatterbot-0.6.2 lib/chatterbot/tweet.rb
chatterbot-0.6.1 lib/chatterbot/tweet.rb