-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trim telegram audio captions to 1024 symbols #52
Conversation
2722090
to
47de8d4
Compare
47de8d4
to
d011c9a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a couple of minor things
@@ -75,7 +75,7 @@ func (client TelegramClient) Send(channelID string, item feed.Item) (err error) | |||
func (client TelegramClient) sendText(channelID string, item feed.Item) (*tb.Message, error) { | |||
message, err := client.Bot.Send( | |||
recipient{chatID: channelID}, | |||
client.getMessageHTML(item, true), | |||
client.getMessageHTML(item, true, false), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a small suggestion: having two bool params one after another is hard to reason about, especially without IDE help. Adding a small private struct like sendParams and passing it, will make things more readable
messageHTML := description | ||
|
||
func (client TelegramClient) getMessageHTML(item feed.Item, withMp3Link, trimCaption bool) string { | ||
var header, footer string | ||
title := strings.TrimSpace(item.Title) | ||
if title != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this if/switch construct is a little bit award. Isn't all of this just a couple of ifs? i.e. title != "" && item.Link == ""
and title != "" && item.Link != ""
I'll merge it as it solves a real problem. Feel free to adress comments as you have a moment |
That PR allows posting audio with long captions to Telegram.