From 9c815511c31e0f157c85bda612a1b73a50bebc0a Mon Sep 17 00:00:00 2001 From: Paul Hammond Date: Fri, 30 Jan 2015 14:54:31 -0800 Subject: [PATCH] Add support for chat.postMessage API method --- src/channel.coffee | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/channel.coffee b/src/channel.coffee index 34cbe5542..a6f25246b 100644 --- a/src/channel.coffee +++ b/src/channel.coffee @@ -86,6 +86,19 @@ class Channel m = new Message @_client, {text: text} @sendMessage m + postMessage: (data) -> + params = data + params.channel = @id + if data.attachments + params.attachments = JSON.stringify(data.attachments) + + @_client.logger.debug data + @_client.logger.debug params + @_client._apiCall "chat.postMessage", params, @_onPostMessage + + _onPostMessage: (data) => + @_client.logger.debug data + sendMessage: (message) -> message.channel = @id @_client._send(message)