You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
750 B

пре 4 година
package service
import "github.com/unknwon/goconfig"
пре 4 година
func SendMessage(conf *goconfig.ConfigFile, title, msg string) error {
if conf.MustValue("messenger", "enable", "false") == "true" {
//钉钉机器人
if conf.MustValue("messenger", "type", "none") == "dingtalk" {
dingtalk := NewDingtalk(conf)
err := dingtalk.Send(title, msg)
return err
}
пре 4 година
//邮件发送
пре 4 година
if conf.MustValue("messenger", "type", "none") == "smtp" {
email := NewEmail(conf)
err := email.Send([]string{conf.MustValue("messenger", "email", "")}, title, msg)
пре 4 година
return err
}
//Server酱推送
пре 4 година
if conf.MustValue("messenger", "type", "none") == "wechat" {
wechat := NewWechat(conf)
err := wechat.Send(title, msg)
пре 4 година
return err
}
}
return nil
пре 4 година
}