diff options
author | Qais Patankar <qaisjp@gmail.com> | 2020-03-21 20:03:12 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-21 21:03:12 +0100 |
commit | d4acdf2f896f46e78916ba34b3cb942e6b677d7b (patch) | |
tree | aedccd56da4432bff188ff09864d152123af7f40 /bridge/slack/handlers.go | |
parent | 0951e75c859e05508b0f2b2306acf963a863d5f9 (diff) | |
download | matterbridge-msglm-d4acdf2f896f46e78916ba34b3cb942e6b677d7b.tar.gz matterbridge-msglm-d4acdf2f896f46e78916ba34b3cb942e6b677d7b.tar.bz2 matterbridge-msglm-d4acdf2f896f46e78916ba34b3cb942e6b677d7b.zip |
Use blocks not attachments (slack) (#1048)
This removes the extra space below messages, as shown in
https://user-images.githubusercontent.com/923242/77235190-a3359980-6bab-11ea-8b7b-697d730ae5c1.png
Diffstat (limited to 'bridge/slack/handlers.go')
-rw-r--r-- | bridge/slack/handlers.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/bridge/slack/handlers.go b/bridge/slack/handlers.go index 12e272d7..015a2e1c 100644 --- a/bridge/slack/handlers.go +++ b/bridge/slack/handlers.go @@ -124,10 +124,16 @@ func (b *Bslack) skipMessageEvent(ev *slack.MessageEvent) bool { } } + // Check for our callback ID + hasOurCallbackID := false + if len(ev.Blocks.BlockSet) == 1 { + block, ok := ev.Blocks.BlockSet[0].(*slack.SectionBlock) + hasOurCallbackID = ok && block.BlockID == "matterbridge_"+b.uuid + } + // Skip any messages that we made ourselves or from 'slackbot' (see #527). if ev.Username == sSlackBotUser || - (b.rtm != nil && ev.Username == b.si.User.Name) || - (len(ev.Attachments) > 0 && ev.Attachments[0].CallbackID == "matterbridge_"+b.uuid) { + (b.rtm != nil && ev.Username == b.si.User.Name) || hasOurCallbackID { return true } |