mirror of
https://github.com/miniflux/v2.git
synced 2025-08-01 17:38:37 +00:00
parent
c0e954f19d
commit
e0e8a99abe
26 changed files with 85 additions and 44 deletions
|
@ -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,19 +31,21 @@ 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)
|
||||
return err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue