Module: Chatterbot::Tweet

Included in:
Bot
Defined in:
lib/chatterbot/tweet.rb

Overview

routines for sending tweets

Instance Method Summary collapse

Instance Method Details

#reply(txt, source) ⇒ Object

reply to a tweet


27
28
29
30
# File 'lib/chatterbot/tweet.rb', line 27

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

#tweet(txt, params = {}, original = nil) ⇒ Object

simple wrapper for sending a message


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/chatterbot/tweet.rb', line 7

def tweet(txt, params = {}, original = nil)
  return if  == 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