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 // Send product photos
if (product.photo_url) { if (product.photo_url) {
await this.bot.sendPhoto(chatId, product.photo_url, { caption: 'Public photo' }); 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) { if (product.hidden_photo_url) {
await this.bot.sendPhoto(chatId, product.hidden_photo_url, { caption: 'Hidden photo' }); 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, { await this.bot.deleteMessage(chatId, messageId);
chat_id: chatId, await this.bot.sendMessage(chatId, message, { reply_markup: keyboard });
message_id: messageId,
reply_markup: keyboard
});
} catch (error) { } catch (error) {
console.error('Error in handleViewProduct:', error); console.error('Error in handleViewProduct:', error);
await this.bot.sendMessage(chatId, 'Error loading product details. Please try again.'); await this.bot.sendMessage(chatId, 'Error loading product details. Please try again.');