Add support for multiple webhooks

This commit is contained in:
Daniel Mason 2021-09-02 14:56:36 +12:00
parent d43fe6afbe
commit b4a4ce6cb2
Signed by: idanoo
GPG key ID: 387387CDBC02F132
3 changed files with 11 additions and 9 deletions

View file

@ -8,10 +8,10 @@ import (
)
// Slack webhook URL
var SlackWebhook string
var SlackWebhooks []string
func postToSlack() {
if SlackWebhook == "" {
if len(SlackWebhooks) == 0 {
return
}
@ -32,8 +32,10 @@ func postToSlack() {
Attachments: []slack.Attachment{attachment1},
}
err := slack.Send(SlackWebhook, "", payload)
if len(err) > 0 {
fmt.Printf("error: %s\n", err)
for _, webhook := range SlackWebhooks {
err := slack.Send(webhook, "", payload)
if len(err) > 0 {
fmt.Print(err)
}
}
}