mirror of
https://github.com/usual2970/certimate.git
synced 2025-10-04 13:34:52 +00:00
Notify Add Lark
This commit is contained in:
@@ -3,6 +3,7 @@ package notify
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/nikoksr/notify/service/lark"
|
||||
"strconv"
|
||||
|
||||
notifyPackage "github.com/nikoksr/notify"
|
||||
@@ -17,6 +18,7 @@ const (
|
||||
notifyChannelDingtalk = "dingtalk"
|
||||
notifyChannelWebhook = "webhook"
|
||||
notifyChannelTelegram = "telegram"
|
||||
notifyChannelLark = "lark"
|
||||
)
|
||||
|
||||
func Send(title, content string) error {
|
||||
@@ -67,6 +69,8 @@ func getNotifiers() ([]notifyPackage.Notifier, error) {
|
||||
notifiers = append(notifiers, temp)
|
||||
case notifyChannelDingtalk:
|
||||
notifiers = append(notifiers, getDingTalkNotifier(v))
|
||||
case notifyChannelLark:
|
||||
notifiers = append(notifiers, getLarkNotifier(v))
|
||||
case notifyChannelWebhook:
|
||||
notifiers = append(notifiers, getWebhookNotifier(v))
|
||||
}
|
||||
@@ -108,6 +112,10 @@ func getDingTalkNotifier(conf map[string]any) notifyPackage.Notifier {
|
||||
})
|
||||
}
|
||||
|
||||
func getLarkNotifier(conf map[string]any) notifyPackage.Notifier {
|
||||
return lark.NewWebhookService(getString(conf, "webhookUrl"))
|
||||
}
|
||||
|
||||
func getString(conf map[string]any, key string) string {
|
||||
if _, ok := conf[key]; !ok {
|
||||
return ""
|
||||
|
Reference in New Issue
Block a user