Class: Twitter::DirectMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/twittbot/gem_ext/twitter/direct_message.rb

Instance Method Summary collapse

Instance Method Details

#reply(direct_message_text) ⇒ Object

Replies to this direct message.

Parameters:

  • direct_message_text (:String)

    direct message text



5
6
7
8
9
10
11
# File 'lib/twittbot/gem_ext/twitter/direct_message.rb', line 5

def reply(direct_message_text)
  return if $bot.nil? or $bot[:client].nil?

  $bot[:client].create_direct_message self.sender.id, direct_message_text
rescue Twitter::Error => e
  puts "caught Twitter error while replying via DM: #{e.message}"
end