Add Telegram as a notification destination (#30)

Allows notifications to be sent via a Telegram bot to a set of pre
defined chat IDs.

Messages are simple plain text with the bare minimum information.
This commit is contained in:
Dan Nixon
2020-01-28 19:28:57 +00:00
committed by CrazyMax
parent c38447b9ab
commit af36d86d82
11 changed files with 121 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ import (
"github.com/crazy-max/diun/internal/notif/mail"
"github.com/crazy-max/diun/internal/notif/notifier"
"github.com/crazy-max/diun/internal/notif/slack"
"github.com/crazy-max/diun/internal/notif/telegram"
"github.com/crazy-max/diun/internal/notif/webhook"
"github.com/rs/zerolog/log"
)
@@ -31,6 +32,9 @@ func New(config model.Notif, app model.App) (*Client, error) {
if config.Slack.Enable {
c.notifiers = append(c.notifiers, slack.New(config.Slack, app))
}
if config.Telegram.Enable {
c.notifiers = append(c.notifiers, telegram.New(config.Telegram, app))
}
if config.Webhook.Enable {
c.notifiers = append(c.notifiers, webhook.New(config.Webhook, app))
}