diff --git a/bot/interfaces.go b/bot/interfaces.go index 6cc1e96..98a5160 100644 --- a/bot/interfaces.go +++ b/bot/interfaces.go @@ -37,6 +37,8 @@ const ( type EphemeralID string +type UnfurlLinks bool + type ImageAttachment struct { URL string AltTxt string diff --git a/connectors/slackapp/slackApp.go b/connectors/slackapp/slackApp.go index 6611fc9..e162f7d 100644 --- a/connectors/slackapp/slackApp.go +++ b/connectors/slackapp/slackApp.go @@ -281,6 +281,12 @@ func (s *SlackApp) sendMessage(channel, message string, meMessage bool, args ... ImageURL: a.URL, Text: a.AltTxt, }) + case bot.UnfurlLinks: + if a { + options = append(options, slack.MsgOptionEnableLinkUnfurl()) + } else { + options = append(options, slack.MsgOptionDisableLinkUnfurl()) + } } } } diff --git a/plugins/git/gitea.go b/plugins/git/gitea.go index 47166d7..37f3b5e 100644 --- a/plugins/git/gitea.go +++ b/plugins/git/gitea.go @@ -44,6 +44,6 @@ func (p *GitPlugin) giteaEvent(w http.ResponseWriter, r *http.Request) { chs := p.c.GetArray(fmt.Sprintf("gitea.%s.%s.channels", org, repo), []string{}) for _, ch := range chs { - p.b.Send(p.b.DefaultConnector(), bot.Message, ch, msg) + p.b.Send(p.b.DefaultConnector(), bot.Message, ch, msg, bot.UnfurlLinks(false)) } } diff --git a/plugins/git/github.go b/plugins/git/github.go index c59c7a1..fe39200 100644 --- a/plugins/git/github.go +++ b/plugins/git/github.go @@ -145,6 +145,6 @@ func (p *GitPlugin) githubEvent(w http.ResponseWriter, r *http.Request) { chs := p.c.GetArray(fmt.Sprintf("github.%s.%s.channels", owner, repo), []string{}) for _, ch := range chs { - p.b.Send(p.b.DefaultConnector(), bot.Message, ch, msg) + p.b.Send(p.b.DefaultConnector(), bot.Message, ch, msg, bot.UnfurlLinks(false)) } } diff --git a/plugins/git/gitlab.go b/plugins/git/gitlab.go index bb43745..f00110b 100644 --- a/plugins/git/gitlab.go +++ b/plugins/git/gitlab.go @@ -53,6 +53,6 @@ func (p *GitPlugin) gitlabEvent(w http.ResponseWriter, r *http.Request) { } chs := p.c.GetArray(fmt.Sprintf("gitlab.%s.channels", owner), []string{}) for _, ch := range chs { - p.b.Send(p.b.DefaultConnector(), bot.Message, ch, msg) + p.b.Send(p.b.DefaultConnector(), bot.Message, ch, msg, bot.UnfurlLinks(false)) } }