Fixes stored media groups
This commit is contained in:
parent
3faede7b1c
commit
c4ec74872c
2 changed files with 4 additions and 4 deletions
|
@ -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,
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue