4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-07-07 05:24:03 +00:00

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
This commit is contained in:
Qais Patankar
2020-03-21 20:03:12 +00:00
committed by GitHub
parent 0951e75c85
commit d4acdf2f89
2 changed files with 21 additions and 11 deletions

View File

@ -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
}