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
# File 'lib/lita/handlers/greet.rb', line 8

def say_hello(response)
  return if response.user.name.empty?
  bot_response = response.message.body.gsub(/[1?!]+/, "").gsub(/(\s)*#{robot.config.robot.name}(\s)*/i, "")
  response.reply "#{bot_response} #{(response.user.mention_name || response.user.name)}"
end

#welcome(response) ⇒ Object



14
15
16
# File 'lib/lita/handlers/greet.rb', line 14

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