add image conversion for telegram

This commit is contained in:
2026-02-13 09:37:54 +03:00
parent 1905e7ab16
commit e1ebb83641
5 changed files with 203 additions and 35 deletions
+9 -5
View File
@@ -46,15 +46,19 @@ func formatMemory(mem *search.Memory, publicURL string) string {
return b.String()
}
// imageAttachments returns image attachments from the memo.
func imageAttachments(memo *memos.Memo) []memos.Attachment {
var images []memos.Attachment
// mediaAttachments splits memo attachments into images, videos, and audios.
func mediaAttachments(memo *memos.Memo) (images, videos, audios []memos.Attachment) {
for _, att := range memo.Attachments {
if att.IsImage() {
switch {
case att.IsImage():
images = append(images, att)
case att.IsVideo():
videos = append(videos, att)
case att.IsAudio():
audios = append(audios, att)
}
}
return images
return
}
// splitText splits text into chunks of at most maxLen bytes,