add title
This commit is contained in:
@ -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(`<a href="%s">➢</a> <a href="%s">Link</a>`, genIVLink(link, rhash), link),
|
||||
Text: fmt.Sprintf(`<a href="%s">➢</a> <a href="%s">%s</a>`, genIVLink(link, rhash), link, title),
|
||||
ParseMode: "HTML",
|
||||
}
|
||||
data, err := json.Marshal(msg)
|
||||
|
Reference in New Issue
Block a user