Module: Slack::Web::Chat

Included in:
Slack::Web
Defined in:
lib/slack/web/chat.rb

Constant Summary collapse

SCOPE =
"chat"

Instance Method Summary collapse

Instance Method Details

#chat_delete(params = {}) ⇒ Object

Deletes a message.



7
8
9
10
11
12
# File 'lib/slack/web/chat.rb', line 7

def chat_delete(params = {})
  throw ArgumentError.new("Required arguments :ts missing") if params['ts'].nil?
  throw ArgumentError.new("Required arguments :channel missing") if params['channel'].nil?
  response = @session.do_get "#{SCOPE}.delete", params
  Slack::parse_response(response)
end

#chat_post_message(params = {}) ⇒ Object

Sends a message to a channel.



15
16
17
18
19
20
# File 'lib/slack/web/chat.rb', line 15

def chat_post_message(params = {})
  throw ArgumentError.new("Required arguments :channel missing") if params['channel'].nil?
  throw ArgumentError.new("Required arguments :text missing") if params['text'].nil?
  response = @session.do_get "#{SCOPE}.postMessage", params
  Slack::parse_response(response)
end

#chat_update(params = {}) ⇒ Object

Updates a message.



23
24
25
26
27
28
29
# File 'lib/slack/web/chat.rb', line 23

def chat_update(params = {})
  throw ArgumentError.new("Required arguments :ts missing") if params['ts'].nil?
  throw ArgumentError.new("Required arguments :channel missing") if params['channel'].nil?
  throw ArgumentError.new("Required arguments :text missing") if params['text'].nil?
  response = @session.do_get "#{SCOPE}.update", params
  Slack::parse_response(response)
end