Skip to content

Commit

Permalink
Save finished text in variable instead of constructing it everytime i…
Browse files Browse the repository at this point in the history
…n the loop
  • Loading branch information
Brawl345 committed Mar 8, 2022
1 parent 4374310 commit 8f57d61
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions handler/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,18 @@ func (h Handler) check() error {
btn := replyMarkup.URL("Eilmeldung aufrufen", result.BreakingNews.Url)
replyMarkup.Inline(replyMarkup.Row(btn))

groupText := "#EIL: " + sb.String()
privateText := sb.String() + textLink

for _, subscriber := range h.Config.Subscribers {
if subscriber < 0 { // Group
_, err = h.Bot.Send(telebot.ChatID(subscriber), "#EIL: "+sb.String(), &telebot.SendOptions{
_, err = h.Bot.Send(telebot.ChatID(subscriber), groupText, &telebot.SendOptions{
DisableWebPagePreview: true,
ParseMode: telebot.ModeHTML,
ReplyMarkup: replyMarkup,
})
} else {
_, err = h.Bot.Send(telebot.ChatID(subscriber), sb.String()+textLink, defaultSendOptions)
_, err = h.Bot.Send(telebot.ChatID(subscriber), privateText, defaultSendOptions)
}

if err != nil {
Expand Down

0 comments on commit 8f57d61

Please sign in to comment.