diff options
Diffstat (limited to 'internal/integration')
-rw-r--r-- | internal/integration/integration.go | 1 | ||||
-rw-r--r-- | internal/integration/telegrambot/telegrambot.go | 22 |
2 files changed, 13 insertions, 10 deletions
diff --git a/internal/integration/integration.go b/internal/integration/integration.go index 7d71844c..2c8eeed6 100644 --- a/internal/integration/integration.go +++ b/internal/integration/integration.go @@ -354,6 +354,7 @@ func PushEntries(feed *model.Feed, entries model.Entries, userIntegrations *mode userIntegrations.TelegramBotTopicID, userIntegrations.TelegramBotDisableWebPagePreview, userIntegrations.TelegramBotDisableNotification, + userIntegrations.TelegramBotDisableButtons, ); err != nil { slog.Error("Unable to send entry to Telegram", slog.Int64("user_id", userIntegrations.UserID), 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) |