mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-29 16:14:43 +00:00
Send Test Notification Type fix
This commit is contained in:
@@ -91,14 +91,17 @@ func SendNotification(providerType NotificationType, config json.RawMessage, tes
|
||||
|
||||
func sendTelegramNotification(config json.RawMessage, test NotificationTest) error {
|
||||
var cfg struct {
|
||||
BotToken string `json:"botToken"`
|
||||
ChatID string `json:"chatID"`
|
||||
Token string `json:"token"`
|
||||
ChatID string `json:"chat_id"`
|
||||
}
|
||||
|
||||
if err := json.Unmarshal(config, &cfg); err != nil {
|
||||
return fmt.Errorf("invalid Telegram config: %w", err)
|
||||
}
|
||||
|
||||
fmt.Println("Token:", cfg.Token)
|
||||
fmt.Println("ChatID:", cfg.ChatID)
|
||||
|
||||
log.Printf("Sending Telegram test to chat %s", cfg.ChatID)
|
||||
return nil
|
||||
}
|
||||
@@ -144,7 +147,7 @@ func getPendingTests() ([]NotificationTest, error) {
|
||||
FROM notification_tests t
|
||||
JOIN notification_providers p
|
||||
ON "t"."notificationProviderId" = p.id
|
||||
WHERE t.success IS NOT TRUE`
|
||||
WHERE t.sent IS NOT TRUE`
|
||||
|
||||
rows, err := db.Query(query)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user