I have tried to download 4 photos of the same message but I can’t get it, here is the code I tried
This downloads only 1 image
if (message.media) {
const link = await handleMedia(message.media, userId);
if (link.includes("pdf")) {
filesRecibeds.add(link);
} else {
img_recibeds.push(link);
}
}
and this downloads the same photo 2 times, but not the 4 that are in the message, what am I doing wrong?
if (message.groupedId) {
const albumMessages = await client.getMessages(message.peerId, {
ids: message.id,
});
for (const mediaMessage of albumMessages) {
if (mediaMessage.groupedId === message.groupedId) {
if (mediaMessage.media) {
const link = await handleMedia(mediaMessage.media, userId);
if (link.includes("pdf")) {
filesRecibeds.add(link);
} else {
img_recibeds.push(link);
}
}
}
}
}
New contributor
Cristhian Palacios is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.