From df3149e59a927b87512caa8f2662c61d15d40384 Mon Sep 17 00:00:00 2001 From: Artyom Ashirov <1323ED5@gmail.com> Date: Fri, 15 Nov 2024 07:31:46 +0300 Subject: [PATCH] product photo fix --- corrupt-photo.jpg | Bin 0 -> 8308 bytes src/handlers/adminProductHandler.js | 19 ++++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 corrupt-photo.jpg diff --git a/corrupt-photo.jpg b/corrupt-photo.jpg new file mode 100644 index 0000000000000000000000000000000000000000..df39d0c13173163d0665d959684a47fee26dc1f6 GIT binary patch literal 8308 zcmdT}2V4``)}IuLfRsf9q=leZfFv{pq)LrT2LTn8kPIP`Mv4?0;NmJMVg-d=0bLhS zSW#3!T~Prm0%FGoc5tx(tD?YnXHo#)?!Mi(@BM!JO~}l-=brOF|8wr0Gf5b}J^TpL zoa;mNfiU2(#8^Vma0gW4oy>}ZAS!hRqzpk24pPTpp(r5PfcGSf0)zqAEbumv%3FYp z9G*OZK+G4x3<95(46_MwEH+GF(Ro}F!HdSBF<}COM;CKou86>5v&BM@fF@$`xCCJe zCzi)15yDtZE+JOHOMtlq22DgGEQ9GHo`7Tt0wOVG*WnI@_IQzq??fhZg(Mn-7Ymc< zJPtXT#wS~oC}halEtyZFC%_^?EX-taU5KwwoF)=j3>RXgeE=nZ?+M4V{89yQSZZK6 zJvD*u$RN78syHV*C3E;37z9q{u(?8~WEUa|?gV5+O(wdkjB^$+;+#Uge55vDoSOE(wVG377OSa+)%@7C)h8HZP3s`)#0thB8mM0du z5Q$P?emqaa6UOuSa`-X1%BRtcWlmJSh;9dx04o8@{Xh&lN=hhVkVjjfu4t-cB7q={ z>kErSDO6;&guYata5)M{9A0ojH^aj>G;SlKwrg8{Hm z7BgNnCgQ*D906(ryyWF|@)W=f76^*gg&-*mnH47D(GyT3BH@dQIe7?$u!!pALbSGZ zbhLMHaF}I-kr*ZhR5w(yf7SLfACXdHt!*VShOw+*4<${z9tP98wRNBc4 z++zVOE{n^Q*Y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#kgG3gO(uN*?da`qi=8m(ghPDNXweQczS06W6 z`2P8SR-%7bd$p1b1IV(oczNmKF5TM9p8rh9YV*ocdU5+EvWA5!vU8M?=9>4|)!XyJ hNc$G~*X|VCbivmz@BeGV(6jTMW1vd6cg*2C{|BE4>DT}O literal 0 HcmV?d00001 diff --git a/src/handlers/adminProductHandler.js b/src/handlers/adminProductHandler.js index a6860b4..6e8bc2d 100644 --- a/src/handlers/adminProductHandler.js +++ b/src/handlers/adminProductHandler.js @@ -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.');