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

View file

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