When i want to save multiple image to database it's only save the last on telegram

75 Views Asked by At
if (req[0].site == '1') {
    link = await bot.telegram.getFileLink(ctx.message.photo[ctx.message.photo.length - 1].file_id) // Save the last image
    await console.log(link.href) // Print the last image url to know it's the good
    await db.query(`UPDATE base SET photo = '${link.href} \n ${req[0].photo} ' where user = '${ctx.chat.id}'`) // To add to the database, but it's only save the last sended picture
    return;
}

I try to know where was the problem, change my db query but it's not that, check if all of my code is in await and it's good

0

There are 0 best solutions below