Class: KITT::CommandsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/kitt/commands_controller.rb

Instance Method Summary collapse

Instance Method Details

#highfiveObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/kitt/commands_controller.rb', line 3

def highfive
  slug = if params[:text].present?
           params[:text].parameterize
         elsif params[:channel_name].in?(%w(directmessage privategroup))
           SecureRandom.uuid
         else
           params[:channel_name]
         end

  url = "#{params[:team_domain]}.highfive.com/#{slug}"
  text = "Join <@#{params[:user_name]}>'s call at: <https://#{url}|#{url}>"

  slack.ping(text, {
    channel: params[:channel_id],
    icon_emoji: ":highfive:",
    username: "Highfive"
  })

  head :ok
end