Skip to content

Commit

Permalink
Repair the missing getBody method, not updated in testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Don Goodman-Wilson committed Jun 20, 2016
1 parent 62062c7 commit 710454c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/slack.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class SlackBot extends Adapter
user = @client.dataStore.getUserById msg.user if msg.user
user.room ?= msg.channel if channel and user

rawText = msg.text
rawText = @getBody msg
text = @removeFormatting rawText

if msg.hidden or (not rawText and not msg.attachments) or msg.subtype is 'bot_message' or not msg.user or not channel
Expand Down Expand Up @@ -163,6 +163,19 @@ class SlackBot extends Adapter

@receive new SlackTextMessage user, text, rawText, msg

getBody: (message) ->
body = ""
if message.text
body += message.text
if message.attachments
if message.text
body += '\n'
for attachment in message.attachments
if attachment != message.attachments[0]
body += '\n'
body += attachment.fallback
body

removeFormatting: (text) ->
# https://api.slack.com/docs/formatting
text = text.replace ///
Expand Down

0 comments on commit 710454c

Please sign in to comment.