From 987f117f318c90228724a51c15838552ff21fcb1 Mon Sep 17 00:00:00 2001 From: Anton Bogdanovich <27antonb@gmail.com> Date: Mon, 11 May 2026 16:18:12 -0700 Subject: [PATCH] style(telegram): satisfy formatter rules --- pkg/channels/telegram/telegram.go | 6 ++++-- pkg/channels/telegram/telegram_test.go | 24 ++++++++++++++++++++---- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/pkg/channels/telegram/telegram.go b/pkg/channels/telegram/telegram.go index 1a57fc6ed..8fe325b25 100644 --- a/pkg/channels/telegram/telegram.go +++ b/pkg/channels/telegram/telegram.go @@ -44,8 +44,10 @@ var ( reInlineCode = regexp.MustCompile("`([^`]+)`") ) -const defaultMediaGroupDelay = 500 * time.Millisecond -const telegramCaptionLimit = 1024 +const ( + defaultMediaGroupDelay = 500 * time.Millisecond + telegramCaptionLimit = 1024 +) type TelegramChannel struct { *channels.BaseChannel diff --git a/pkg/channels/telegram/telegram_test.go b/pkg/channels/telegram/telegram_test.go index db5a8e784..b52f2c9b2 100644 --- a/pkg/channels/telegram/telegram_test.go +++ b/pkg/channels/telegram/telegram_test.go @@ -272,7 +272,11 @@ func TestSendMedia_MultipleImagesUseMediaGroup(t *testing.T) { firstRef, err := store.Store(firstPath, media.MediaMeta{Filename: "first.png", ContentType: "image/png"}, "scope-1") require.NoError(t, err) - secondRef, err := store.Store(secondPath, media.MediaMeta{Filename: "second.png", ContentType: "image/png"}, "scope-1") + secondRef, err := store.Store( + secondPath, + media.MediaMeta{Filename: "second.png", ContentType: "image/png"}, + "scope-1", + ) require.NoError(t, err) ids, err := ch.SendMedia(context.Background(), bus.OutboundMediaMessage{ @@ -327,7 +331,11 @@ func TestSendMedia_MoreThanTenImagesSplitIntoMediaGroups(t *testing.T) { for i := 0; i < 15; i++ { path := filepath.Join(tmpDir, "image-"+strconv.Itoa(i)+".png") require.NoError(t, os.WriteFile(path, []byte("img-"+strconv.Itoa(i)), 0o644)) - ref, err := store.Store(path, media.MediaMeta{Filename: filepath.Base(path), ContentType: "image/png"}, "scope-1") + ref, err := store.Store( + path, + media.MediaMeta{Filename: filepath.Base(path), ContentType: "image/png"}, + "scope-1", + ) require.NoError(t, err) part := bus.MediaPart{Type: "image", Ref: ref} if i == 0 { @@ -424,7 +432,11 @@ func TestSendMedia_MediaGroupLongCaptionSendsTextFirst(t *testing.T) { firstRef, err := store.Store(firstPath, media.MediaMeta{Filename: "first.png", ContentType: "image/png"}, "scope-1") require.NoError(t, err) - secondRef, err := store.Store(secondPath, media.MediaMeta{Filename: "second.png", ContentType: "image/png"}, "scope-1") + secondRef, err := store.Store( + secondPath, + media.MediaMeta{Filename: "second.png", ContentType: "image/png"}, + "scope-1", + ) require.NoError(t, err) ids, err := ch.SendMedia(context.Background(), bus.OutboundMediaMessage{ @@ -478,7 +490,11 @@ func TestSendMedia_MultiGroupLongCaptionSendsTextBeforeGroups(t *testing.T) { for i := 0; i < 15; i++ { path := filepath.Join(tmpDir, "image-"+strconv.Itoa(i)+".png") require.NoError(t, os.WriteFile(path, []byte("img-"+strconv.Itoa(i)), 0o644)) - ref, err := store.Store(path, media.MediaMeta{Filename: filepath.Base(path), ContentType: "image/png"}, "scope-1") + ref, err := store.Store( + path, + media.MediaMeta{Filename: filepath.Base(path), ContentType: "image/png"}, + "scope-1", + ) require.NoError(t, err) part := bus.MediaPart{Type: "image", Ref: ref} if i == 0 {