Class: Lita::Handlers::Manners

Inherits:
Handler
  • Object
show all
Defined in:
lib/lita/handlers/manners.rb

Instance Method Summary collapse

Instance Method Details

#echo_command(response, message = nil) ⇒ Object



11
12
13
14
# File 'lib/lita/handlers/manners.rb', line 11

def echo_command(response, message = nil)
  echo = message || response.matches[0][0]
  response.reply "#{echo} #{response.user.name}"
end

#echo_message(response) ⇒ Object



16
17
18
19
# File 'lib/lita/handlers/manners.rb', line 16

def echo_message(response)
  message = response.matches[0][0]
  echo_command(response, message) if addressed_to_robot?(response)
end

#sorry_command(response) ⇒ Object



29
30
31
# File 'lib/lita/handlers/manners.rb', line 29

def sorry_command(response)
  response.reply "Apology accepted #{response.user.name}"
end

#sorry_message(response) ⇒ Object



33
34
35
# File 'lib/lita/handlers/manners.rb', line 33

def sorry_message(response)
   sorry_command(response) if addressed_to_robot?(response)
end

#thank_you_command(response) ⇒ Object



21
22
23
# File 'lib/lita/handlers/manners.rb', line 21

def thank_you_command(response)
  response.reply "You're welcome #{response.user.name}"
end

#thank_you_message(response) ⇒ Object



25
26
27
# File 'lib/lita/handlers/manners.rb', line 25

def thank_you_message(response)
  thank_you_command(response) if addressed_to_robot?(response)
end