mirror of
https://github.com/valitydev/botkube.git
synced 2024-11-06 00:15:22 +00:00
feat(slack): add thread support (#423)
##### ISSUE TYPE - Feature Pull Request ##### SUMMARY adding support for botkube to interact in slack threads I did update the test bash script that would not run on my zsh shell on my mac. I Also wanted to add some unit tests but the Slack test server does not support thread messages. Fixes #422
This commit is contained in:
parent
f5dce1ff6b
commit
0ad0536512
@ -20,7 +20,7 @@
|
||||
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
|
||||
set -o pipefail
|
||||
|
||||
export CONFIG_PATH="$(pwd)/test"
|
||||
|
@ -180,7 +180,14 @@ func (sm *slackMessage) Send() {
|
||||
return
|
||||
}
|
||||
|
||||
if _, _, err := sm.RTM.PostMessage(sm.Event.Channel, slack.MsgOptionText("```"+sm.Response+"```", false), slack.MsgOptionAsUser(true)); err != nil {
|
||||
var options = []slack.MsgOption{slack.MsgOptionText("```"+sm.Response+"```", false), slack.MsgOptionAsUser(true)}
|
||||
|
||||
//if the message is from thread then add an option to return the response to the thread
|
||||
if sm.Event.ThreadTimestamp != "" {
|
||||
options = append(options, slack.MsgOptionTS(sm.Event.ThreadTimestamp))
|
||||
}
|
||||
|
||||
if _, _, err := sm.RTM.PostMessage(sm.Event.Channel, options...); err != nil {
|
||||
log.Error("Error in sending message:", err)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user