style(telegram): satisfy formatter rules

This commit is contained in:
Anton Bogdanovich 2026-05-11 16:18:12 -07:00
parent edc2a81be1
commit c94a789791
2 changed files with 24 additions and 6 deletions

View file

@ -44,8 +44,10 @@ var (
reInlineCode = regexp.MustCompile("`([^`]+)`") reInlineCode = regexp.MustCompile("`([^`]+)`")
) )
const defaultMediaGroupDelay = 500 * time.Millisecond const (
const telegramCaptionLimit = 1024 defaultMediaGroupDelay = 500 * time.Millisecond
telegramCaptionLimit = 1024
)
type TelegramChannel struct { type TelegramChannel struct {
*channels.BaseChannel *channels.BaseChannel

View file

@ -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") firstRef, err := store.Store(firstPath, media.MediaMeta{Filename: "first.png", ContentType: "image/png"}, "scope-1")
require.NoError(t, err) 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) require.NoError(t, err)
ids, err := ch.SendMedia(context.Background(), bus.OutboundMediaMessage{ ids, err := ch.SendMedia(context.Background(), bus.OutboundMediaMessage{
@ -327,7 +331,11 @@ func TestSendMedia_MoreThanTenImagesSplitIntoMediaGroups(t *testing.T) {
for i := 0; i < 15; i++ { for i := 0; i < 15; i++ {
path := filepath.Join(tmpDir, "image-"+strconv.Itoa(i)+".png") path := filepath.Join(tmpDir, "image-"+strconv.Itoa(i)+".png")
require.NoError(t, os.WriteFile(path, []byte("img-"+strconv.Itoa(i)), 0o644)) 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) require.NoError(t, err)
part := bus.MediaPart{Type: "image", Ref: ref} part := bus.MediaPart{Type: "image", Ref: ref}
if i == 0 { 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") firstRef, err := store.Store(firstPath, media.MediaMeta{Filename: "first.png", ContentType: "image/png"}, "scope-1")
require.NoError(t, err) 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) require.NoError(t, err)
ids, err := ch.SendMedia(context.Background(), bus.OutboundMediaMessage{ ids, err := ch.SendMedia(context.Background(), bus.OutboundMediaMessage{
@ -478,7 +490,11 @@ func TestSendMedia_MultiGroupLongCaptionSendsTextBeforeGroups(t *testing.T) {
for i := 0; i < 15; i++ { for i := 0; i < 15; i++ {
path := filepath.Join(tmpDir, "image-"+strconv.Itoa(i)+".png") path := filepath.Join(tmpDir, "image-"+strconv.Itoa(i)+".png")
require.NoError(t, os.WriteFile(path, []byte("img-"+strconv.Itoa(i)), 0o644)) 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) require.NoError(t, err)
part := bus.MediaPart{Type: "image", Ref: ref} part := bus.MediaPart{Type: "image", Ref: ref}
if i == 0 { if i == 0 {