Class: SlackChatter::Api::Chat
- Inherits:
-
Base
- Object
- Base
- SlackChatter::Api::Chat
show all
- Defined in:
- lib/slack_chatter/api/chat.rb
Instance Attribute Summary
Attributes inherited from Base
#client
Instance Method Summary
collapse
Methods inherited from Base
#bool_as_i, #call_method, #channel_id_or_name, #initialize
Instance Method Details
#delete(timestamp, channel_id) ⇒ Object
15
16
17
|
# File 'lib/slack_chatter/api/chat.rb', line 15
def delete(timestamp, channel_id)
call_method("chat", "delete", {"channel" => channel_id, "ts" => timestamp})
end
|
#post_message(channel_id, text, opts = {}) ⇒ Object
5
6
7
8
9
10
11
12
13
|
# File 'lib/slack_chatter/api/chat.rb', line 5
def post_message(channel_id, text, opts={})
res = call_method("chat", "postMessage", {"channel" => channel_id, "text" => text}.merge(opts))
if res.ok
return res
else
client.channels.find_by_name(channel_id.gsub('#', '').downcase)
res = call_method("chat", "postMessage", {"channel" => channel_id, "text" => text}.merge(opts))
end
end
|
#update(timestamp, channel_id, text) ⇒ Object
19
20
21
|
# File 'lib/slack_chatter/api/chat.rb', line 19
def update(timestamp, channel_id, text)
call_method("chat", "update", {"channel" => channel_id, "ts" => timestamp, "text" => text})
end
|