media/transfer: add function to directly download bytes

Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
This commit is contained in:
Sumner Evans
2024-10-22 09:21:56 -06:00
parent 5448648c32
commit a573740b9a
4 changed files with 11 additions and 8 deletions
+1 -2
View File
@@ -477,8 +477,7 @@ func (t *TelegramClient) updateChannel(ctx context.Context, channel *tg.Channel)
avatar = &bridgev2.Avatar{
ID: ids.MakeAvatarID(photo.PhotoID),
Get: func(ctx context.Context) (data []byte, err error) {
data, _, err = media.NewTransferer(t.client.API()).WithChannelPhoto(channel.ID, channel.AccessHash, photo.PhotoID).Download(ctx)
return
return media.NewTransferer(t.client.API()).WithChannelPhoto(channel.ID, channel.AccessHash, photo.PhotoID).DownloadBytes(ctx)
},
}
}