product photo fix

This commit is contained in:
Artyom Ashirov 2024-11-15 07:31:46 +03:00
parent de5e405093
commit df3149e59a
2 changed files with 12 additions and 7 deletions

BIN
corrupt-photo.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

View File

@ -564,17 +564,22 @@ Coordinates: ${product.hidden_coordinates}
// Send product photos
if (product.photo_url) {
try {
await this.bot.sendPhoto(chatId, product.photo_url, { caption: 'Public photo' });
} catch (e) {
await this.bot.sendPhoto(chatId, "./corrupt-photo.jpg", { caption: 'Public photo' })
}
}
if (product.hidden_photo_url) {
try {
await this.bot.sendPhoto(chatId, product.hidden_photo_url, { caption: 'Hidden photo' });
} catch (e) {
await this.bot.sendPhoto(chatId, "./corrupt-photo.jpg", { caption: 'Hidden photo' })
}
}
await this.bot.editMessageText(message, {
chat_id: chatId,
message_id: messageId,
reply_markup: keyboard
});
await this.bot.deleteMessage(chatId, messageId);
await this.bot.sendMessage(chatId, message, { reply_markup: keyboard });
} catch (error) {
console.error('Error in handleViewProduct:', error);
await this.bot.sendMessage(chatId, 'Error loading product details. Please try again.');