diff options
Diffstat (limited to 'internal/integration/telegrambot/telegrambot.go')
-rw-r--r-- | internal/integration/telegrambot/telegrambot.go | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/internal/integration/telegrambot/telegrambot.go b/internal/integration/telegrambot/telegrambot.go index b6097b2b..b73b78ae 100644 --- a/internal/integration/telegrambot/telegrambot.go +++ b/internal/integration/telegrambot/telegrambot.go @@ -9,7 +9,7 @@ import ( "miniflux.app/v2/internal/model" ) -func PushEntry(feed *model.Feed, entry *model.Entry, botToken, chatID string, topicID *int64, disableWebPagePreview, disableNotification bool) error { +func PushEntry(feed *model.Feed, entry *model.Entry, botToken, chatID string, topicID *int64, disableWebPagePreview, disableNotification bool, disableButtons bool) error { textTemplate := `<b><a href=%q>%s</a></b> - <a href=%q>%s</a>` formattedText := fmt.Sprintf( textTemplate, @@ -31,18 +31,20 @@ func PushEntry(feed *model.Feed, entry *model.Entry, botToken, chatID string, to message.MessageThreadID = *topicID } - var markupRow []*InlineKeyboardButton + if !disableButtons { + var markupRow []*InlineKeyboardButton - minifluxURLButton := InlineKeyboardButton{Text: "Go to article", URL: entry.URL} - markupRow = append(markupRow, &minifluxURLButton) + minifluxURLButton := InlineKeyboardButton{Text: "Go to article", URL: entry.URL} + markupRow = append(markupRow, &minifluxURLButton) - if entry.CommentsURL != "" { - commentButton := InlineKeyboardButton{Text: "Comments", URL: entry.CommentsURL} - markupRow = append(markupRow, &commentButton) - } + if entry.CommentsURL != "" { + commentButton := InlineKeyboardButton{Text: "Comments", URL: entry.CommentsURL} + markupRow = append(markupRow, &commentButton) + } - message.ReplyMarkup = &InlineKeyboard{} - message.ReplyMarkup.InlineKeyboard = append(message.ReplyMarkup.InlineKeyboard, markupRow) + message.ReplyMarkup = &InlineKeyboard{} + message.ReplyMarkup.InlineKeyboard = append(message.ReplyMarkup.InlineKeyboard, markupRow) + } client := NewClient(botToken, chatID) _, err := client.SendMessage(message) |