Skip to content

Commit

Permalink
Merge pull request #38 from mizoR/slack-thread
Browse files Browse the repository at this point in the history
Enable reply with thread
  • Loading branch information
rosylilly authored Aug 30, 2019
2 parents 742f31c + 06f4775 commit aea33e0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/ruboty/adapters/slack_rtm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ def say(message)
parse: message[:parse] || 'full',
unfurl_links: true,
as_user: true,
attachments: message[:attachments].to_json
attachments: message[:attachments].to_json,
thread_ts: message[:thread_ts] || message[:original][:thread_ts]
)
elsif message[:file]
path = message[:file][:path]
Expand All @@ -46,14 +47,16 @@ def say(message)
file: Faraday::UploadIO.new(path, message[:file][:content_type]),
title: message[:file][:title] || path,
filename: File.basename(path),
initial_comment: message[:body] || ''
initial_comment: message[:body] || '',
thread_ts: message[:thread_ts] || message[:original][:thread_ts]
)
else
client.chat_postMessage(
channel: channel,
text: message[:code] ? "```\n#{message[:body]}\n```" : resolve_send_mention(message[:body]),
as_user: true,
mrkdwn: true
mrkdwn: true,
thread_ts: message[:thread_ts] || message[:original][:thread_ts]
)
end
end
Expand Down Expand Up @@ -156,6 +159,8 @@ def on_message(data)
to: channel_to,
channel: channel,
user: user,
ts: data['ts'],
thread_ts: data['thread_ts'],
time: Time.at(data['ts'].to_f)
}

Expand Down

0 comments on commit aea33e0

Please sign in to comment.