Class: Atig::Command::Dm

Inherits:
Command show all
Defined in:
lib/atig/command/dm.rb

Instance Attribute Summary

Attributes inherited from Command

#api, #db, #gateway, #opts

Instance Method Summary collapse

Methods inherited from Command

#find_by_tid

Constructor Details

#initialize(*args) ⇒ Dm

Returns a new instance of Dm.



11
# File 'lib/atig/command/dm.rb', line 11

def initialize(*args); super end

Instance Method Details

#action(target, mesg, command, args) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/atig/command/dm.rb', line 14

def action(target, mesg, command, args)
  if args.empty?
    yield "/me #{command} <SCREEN_NAME> blah blah"
    return
  end
  user = args.first
  text = mesg.split(" ", 3)[2]
  api.delay(0) do|t|
    t.post("direct_messages/new",{
             screen_name: user,
             text: text
           })
    yield "Sent message to #{user}: #{text}"
  end
end

#command_nameObject



12
# File 'lib/atig/command/dm.rb', line 12

def command_name; %w(d dm dms) end