diff --git a/envvars.go b/envvars.go index 133fcb1..b02100f 100644 --- a/envvars.go +++ b/envvars.go @@ -18,7 +18,7 @@ var ( TelegramBotToken = envvars.String("TELEGRAM_API_TOKEN", "") TelegramChatID = envvars.Int64("TELEGRAM_CHAT_ID", 0) - TelegramOrganizeMessagePatternStr = logic.EscSeqReplacer.Replace(envvars.String("TELEGRAM_ORGANIZE_MESSAGE_PATTERN", `Download finished{{range .}}\n{{.Anime.Title.UserPreferred}} episode {{.Episode}}{{end}}`)) + TelegramOrganizeMessagePatternStr = logic.EscSeqReplacer.Replace(envvars.String("TELEGRAM_ORGANIZE_MESSAGE_PATTERN", `Recently Downloaded Animes ({{len .}} eps){{range .}}\n{{.Anime.Title.UserPreferred}} Episode {{.Episode}}{{end}}`)) TelegramOrganizeMessagePattern = template.Must(template.New("TELEGRAM_ORGANIZE_MESSAGE_PATTERN").Parse(TelegramOrganizeMessagePatternStr)) TelegramOrganizeMessageSendCondition = envvars.ObjectSlice("TELEGRAM_ORGANIZE_MESSAGE_SEND_CONDITION", ",", []SendCondition{SendConditionAlways}, SendConditionFromString) TelegramOrganizeMessageSendInterval = envvars.Duration("TELEGRAM_ORGANIZE_MESSAGE_SEND_INTERVAL", 0) diff --git a/telegram.go b/telegram.go index bb43ac8..507e51d 100644 --- a/telegram.go +++ b/telegram.go @@ -72,11 +72,12 @@ func sendAllQueuedAnimeEpisodes() { } func SendTelegramMessage(text string) { - if TelegramBot == nil { + if TelegramBot == nil || strings.TrimSpace(text) == "" { return } msg := tgbotapi.NewMessage(TelegramChatID, text) + msg.ParseMode = "html" _, err := TelegramBot.Send(msg) if err != nil { adverr.Println(adverr.Wrap("could not send telegram message", err))