Sha256: 941c38d0a72035e1587668a51647239175d309d776232ec3882410acaf1f091e

Contents?: true

Size: 697 Bytes

Versions: 7

Compression:

Stored size: 697 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
      #:nocov:
      debug e
      false
      #:nocov:
    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-1.0.2 lib/chatterbot/tweet.rb
chatterbot-1.0.1 lib/chatterbot/tweet.rb
chatterbot-1.0.0 lib/chatterbot/tweet.rb
chatterbot-0.9.3 lib/chatterbot/tweet.rb
chatterbot-0.9.2 lib/chatterbot/tweet.rb
chatterbot-0.9.1 lib/chatterbot/tweet.rb
chatterbot-0.9.0 lib/chatterbot/tweet.rb