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(ts, channel) ⇒ Object

Deletes a message.



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

def chat_delete(ts, channel)
  param = {
    "ts" => ts,
    "channel" => channel
  }
  response = @session.do_get "#{SCOPE}.delete", param
  Slack::parse_response(response)
end

#chat_post_message(channel, text, username, as_user = false, parse, link_names, attachments) ⇒ Object

Sends a message to a channel.



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/slack/web/chat.rb', line 17

def chat_post_message(channel, text, username, as_user= false, parse, link_names, attachments)
  param = {
    "channel" => channel,
    "text" => text,
    "username" => username,
    "as_user" => as_user,
    "parse" => parse,
    "link_names" => link_names,
    "attachments" => attachments
  }
  response = @session.do_get "#{SCOPE}.postMessage", param
  Slack::parse_response(response)
end

#chat_update(ts, channel, text) ⇒ Object

Updates a message.



32
33
34
35
36
37
38
39
40
# File 'lib/slack/web/chat.rb', line 32

def chat_update(ts, channel, text)
  param = {
    "ts" => ts,
    "channel" => channel,
    "text" => text
  }
  response = @session.do_get "#{SCOPE}.update", param
  Slack::parse_response(response)
end