product photo fix
This commit is contained in:
parent
de5e405093
commit
df3149e59a
BIN
corrupt-photo.jpg
Normal file
BIN
corrupt-photo.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.1 KiB |
@ -564,17 +564,22 @@ Coordinates: ${product.hidden_coordinates}
|
||||
|
||||
// Send product photos
|
||||
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) {
|
||||
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, {
|
||||
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.');
|
||||
|
Loading…
Reference in New Issue
Block a user