aboutsummaryrefslogtreecommitdiff
path: root/internal/integration/telegrambot/telegrambot.go
diff options
context:
space:
mode:
authorGravatar Jany <127505435+janydoe@users.noreply.github.com> 2023-09-28 03:02:22 +0000
committerGravatar GitHub <noreply@github.com> 2023-09-27 20:02:22 -0700
commite0e8a99abe919b8cc2dc292fb8efc2c31f42ad80 (patch)
treed8337842ed96f17e31add109423adfaab3a08a24 /internal/integration/telegrambot/telegrambot.go
parentc0e954f19d707fef8ef8271636ec661634a4c4c7 (diff)
downloadv2-e0e8a99abe919b8cc2dc292fb8efc2c31f42ad80.tar.gz
v2-e0e8a99abe919b8cc2dc292fb8efc2c31f42ad80.tar.zst
v2-e0e8a99abe919b8cc2dc292fb8efc2c31f42ad80.zip
Telegram: add the possibility to disable buttons
Closes #2093
Diffstat (limited to 'internal/integration/telegrambot/telegrambot.go')
-rw-r--r--internal/integration/telegrambot/telegrambot.go22
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)