feat(push): add telegram bot push notification channel

Implement TelegramPusher in pkg/push, register config schema in channels_definition.go, add validation in model/push_channel.go, update task routing, and update settings-tab.tsx UI validation.
This commit is contained in:
ryan
2026-06-15 14:42:49 +08:00
parent cb018b3b60
commit de58b118b4
18 changed files with 394 additions and 60 deletions
+10
View File
@@ -19,6 +19,8 @@ const (
TypeCustom = "custom"
// TypeEmail 邮件推送消息通道类型
TypeEmail = "email"
// TypeTelegram 电报机器人推送消息通道类型
TypeTelegram = "telegram"
)
// PushChannel 消息通道模型
@@ -53,6 +55,10 @@ func (pc *PushChannel) Validate() error {
pc.Type = TypeCustom
}
if pc.Type == TypeTelegram && pc.URL == "" {
pc.URL = "https://api.telegram.org"
}
if pc.Name == "" {
return errors.New("channel name is required")
}
@@ -77,6 +83,10 @@ func (pc *PushChannel) Validate() error {
return validateJSON(pc.Other)
case TypeEmail:
// Email channel SMTP configs fall back to global settings, so they are not required to be filled.
case TypeTelegram:
if pc.Token == "" {
return errors.New("telegram bot token is required")
}
}
return nil
}