Skip to content

Commit

Permalink
Feat: add not found notification for discord user
Browse files Browse the repository at this point in the history
  • Loading branch information
junho100 committed Dec 5, 2024
1 parent 194874d commit a781ecb
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions internal/infrastructure/cron/cron.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,22 @@ func (c *CronJob) Start() {
now := time.Now().In(c.cron.Location())
checkTime := now.Format("2006-01-02 15:04")
message := fmt.Sprintf("[취Go 알림]\n발견된 공지사항이 없습니다.\n확인 시각: %s", checkTime)
encodedText := url.QueryEscape(message)
if err := c.telegramClient.SendMessage(config.TelegramToken, config.TelegramChatID, encodedText); err != nil {
log.Printf("알림 전송 실패 (사용자: %s): %v", config.UserID, err)

// Telegram 알림 전송
if config.TelegramToken != "" && config.TelegramChatID != "" {
encodedText := url.QueryEscape(message)
if err := c.telegramClient.SendMessage(config.TelegramToken, config.TelegramChatID, encodedText); err != nil {
log.Printf("텔레그램 알림 전송 실패 (사용자: %s): %v", config.UserID, err)
}
}

// Discord 알림 전송
if config.DiscordClientID != "" {
if err := c.discordClient.SendMessage(config.DiscordClientID, message); err != nil {
log.Printf("Discord 알림 전송 실패 (사용자: %s): %v", config.UserID, err)
}
}

continue
}

Expand Down

0 comments on commit a781ecb

Please sign in to comment.