Fixes stored media groups

This commit is contained in:
stefanodvx 2025-04-14 13:59:22 +02:00
parent 3faede7b1c
commit c4ec74872c
2 changed files with 4 additions and 4 deletions

View file

@ -111,9 +111,9 @@ func HandleDefaultStoredFormatDownload(
storedMedias[0], storedMedias[0],
isCaptionEnabled, isCaptionEnabled,
) )
var formats []*models.DownloadedMedia var medias []*models.DownloadedMedia
for _, media := range storedMedias { for _, media := range storedMedias {
formats = append(formats, &models.DownloadedMedia{ medias = append(medias, &models.DownloadedMedia{
FilePath: "", FilePath: "",
ThumbnailFilePath: "", ThumbnailFilePath: "",
Media: media, Media: media,
@ -121,7 +121,7 @@ func HandleDefaultStoredFormatDownload(
} }
_, err := SendMedias( _, err := SendMedias(
bot, ctx, dlCtx, bot, ctx, dlCtx,
formats, medias,
&models.SendMediaFormatsOptions{ &models.SendMediaFormatsOptions{
Caption: messageCaption, Caption: messageCaption,
IsStored: true, IsStored: true,

View file

@ -39,7 +39,7 @@ func StoreMedia(
if err := tx.Where(models.Media{ if err := tx.Where(models.Media{
ExtractorCodeName: extractorCodeName, ExtractorCodeName: extractorCodeName,
ContentID: contentID, ContentID: contentID,
}).FirstOrCreate(&media).Error; err != nil { }).Create(&media).Error; err != nil {
return fmt.Errorf("failed to get or create media: %w", err) return fmt.Errorf("failed to get or create media: %w", err)
} }
if media.Format != nil { if media.Format != nil {