Class: Lita::Handlers::Greet

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

Instance Method Summary collapse

Instance Method Details

#say_hello(response) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/lita/handlers/greet.rb', line 8

def say_hello(response)
  return if response.user.name.empty?
  reply_to_name = response.user.['mention_name'].nil? ?
                   "#{response.user.name}" :
                  "#{response.user.['mention_name']}"
  response.reply "Hello #{reply_to_name}!"
end

#welcome(response) ⇒ Object



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

def welcome(response)
  response.reply "Hello and Welcome #{response.matches[0][0]}!"
end