diff --git a/TODO.md b/TODO.md
index 2bf0581..0b730e4 100644
--- a/TODO.md
+++ b/TODO.md
@@ -15,8 +15,7 @@
* ✓ Implement atom
* ✓ Cleanup
* Show Feed name instead of Link
-* Change flags to os.Args[1] for config path
-* Make Rhash optional
+* ✓ Make Rhash optional
## Issues
* ✓ Last record is not written fully to csv: *Fixed*. Had to Flush writer
@@ -52,6 +51,7 @@
* Filter from app based on keyword
* Move telegram auth token to credential file
* Check if context is used correctly
+* Change flags to os.Args[1] for config path
### Log
* Log to file
diff --git a/app/app.go b/app/app.go
index 79db2db..df22099 100644
--- a/app/app.go
+++ b/app/app.go
@@ -104,7 +104,7 @@ func ProcessFeed(feed FeedCfg, scheduler Scheduler, dbDir string, tgram telegram
Time: time.Now(),
FeedEntry: entry,
}
- err := tgram.SendLink(entry.Link, feed.Channel, feed.Rhash)
+ err := tgram.SendLink(entry.Link, feed.Channel, feed.Rhash, feed.Title)
if err != nil {
log.Error("failed to send to telegram", "feed", feed.Name, "link", entry.Link, "channel", feed.Channel, "rhash", feed.Rhash, "error", err)
r.Status = Error
diff --git a/app/config.go b/app/config.go
index 92843ef..997355e 100644
--- a/app/config.go
+++ b/app/config.go
@@ -20,6 +20,7 @@ type FeedCfg struct {
Cron string `yaml:"cron"`
Proxy string `yaml:"proxy"`
Type parser.FeedType `yaml:"type"`
+ Title string `yaml:"title"`
FTL *int `yaml:"first_time_limit"`
FirstTimeLimit FeedLimit `yaml:"-"`
}
diff --git a/telegram/telegram.go b/telegram/telegram.go
index 91e9e17..635a564 100644
--- a/telegram/telegram.go
+++ b/telegram/telegram.go
@@ -16,7 +16,7 @@ import (
)
type TelegramSender interface {
- SendLink(link, channel, rhash string) error
+ SendLink(link, channel, rhash, title string) error
}
type telegramSender struct {
@@ -26,14 +26,17 @@ type telegramSender struct {
rateLimiterPerSec *rate.Limiter
}
-func (ts *telegramSender) SendLink(link string, channel string, rhash string) error {
+func (ts *telegramSender) SendLink(link, channel, rhash, title string) error {
+ if title == "" {
+ title = "Link"
+ }
msg := struct {
ChatID string `json:"chat_id"`
Text string `json:"text"`
ParseMode string `json:"parse_mode"`
}{
ChatID: channel,
- Text: fmt.Sprintf(`➢ Link`, genIVLink(link, rhash), link),
+ Text: fmt.Sprintf(`➢ %s`, genIVLink(link, rhash), link, title),
ParseMode: "HTML",
}
data, err := json.Marshal(msg)