canove / whaticket-community

A very simple Ticket System based on WhatsApp messages, that allow multi-users in same WhatsApp account.
MIT License
1.51k stars 773 forks source link

Error npm run build #604

Open brendorsilva opened 8 months ago

brendorsilva commented 8 months ago

When running npm run build I am receiving the following error:

deploy@admistrador-Standard-PC-i440FX-PIIX-1996:~/whaticket/backend$ npm run build

backend@1.0.0 build tsc

src/services/WbotServices/wbotMessageListener.ts:152:77 - error TS2339: Property 'description' does not exist on type 'Location'.

152 await ticket.update({ lastMessage: msg.type === "location" ? msg.location.description ? "Localization - " + msg.location.description.split('\n')[0] : "Localization" : msg.body });


src/services/WbotServices/wbotMessageListener.ts:152:124 - error TS2339: Property 'description' does not exist on type 'Location'.

152   await ticket.update({ lastMessage: msg.type === "location" ? msg.location.description ? "Localization - " + msg.location.description.split('\\n')[0] : "Localization" : msg.body });

src/services/WbotServices/wbotMessageListener.ts:162:35 - error TS2339: Property 'description' does not exist on type 'Location'.

162 msg.body += "|" + (msg.location.description ? msg.location.description : (msg.location.latitude + ", " + msg.location.longitude))


src/services/WbotServices/wbotMessageListener.ts:162:62 - error TS2339: Property 'description' does not exist on type 'Location'.

162   msg.body += "|" + (msg.location.description ? msg.location.description : (msg.location.latitude + ", " + msg.location.longitude))

Found 4 errors.

alissonerai commented 7 months ago

estou com o mesmo problema , nao encontrei em lugar algum a soluçao ,

src/services/WbotServices/wbotMessageListener.ts:152:77 - error TS2339: Property 'description' does not exist on type 'Location'.

152 await ticket.update({ lastMessage: msg.type === "location" ? msg.location.description ? "Localization - " + msg.location.description.split('\n')[0] : "Localization" : msg.body });

      ~~~~~~~~~~~

src/services/WbotServices/wbotMessageListener.ts:152:124 - error TS2339: Property 'description' does not exist on type 'Location'.

152 await ticket.update({ lastMessage: msg.type === "location" ? msg.location.description ? "Localization - " + msg.location.description.split('\n')[0] : "Localization" : msg.body });

                  ~~~~~~~~~~~  

src/services/WbotServices/wbotMessageListener.ts:162:35 - error TS2339: Property 'description' does not exist on type 'Location'.

162 msg.body += "|" + (msg.location.description ? msg.location.description : (msg.location.latitude + ", " + msg.location.longitude))


src/services/WbotServices/wbotMessageListener.ts:162:62 - error TS2339: Property 'description' does not exist on type 'Location'.

162   msg.body += "|" + (msg.location.description ? msg.location.description : (msg.location.latitude + ", " + msg.location.longitude))     

Found 4 errors.

egorky commented 7 months ago

well, you have to change in this file backend/src/services/WbotServices/wbotMessageListener.ts the following: const prepareLocation = (msg: WbotMessage): WbotMessage => { const gmapsUrl = https://maps.google.com/maps?q=${msg.location.latitude}%2C${msg.location.longitude}&z=17; msg.body = data:image/png;base64,${msg.body}|${gmapsUrl}; msg.body += |${msg.location.options ? msg.location.options :${msg.location.latitude}, ${msg.location.longitude} }; return msg; };

const verifyMessage = async ( msg: WbotMessage, ticket: Ticket, contact: Contact ) => { if (msg.type === "location") msg = prepareLocation(msg);

const quotedMsg = await verifyQuotedMessage(msg); const messageData = { id: msg.id.id, ticketId: ticket.id, contactId: msg.fromMe ? undefined : contact.id, body: msg.body, fromMe: msg.fromMe, mediaType: msg.type, read: msg.fromMe, quotedMsgId: quotedMsg?.id };

await ticket.update({ lastMessage: msg.type === "location" ? msg.location.options || "Localization" : msg.body });

await CreateMessageService({ messageData }); };

mfallas1905 commented 7 months ago

Thanks @egorky for your solution

HZetaVirus commented 6 months ago

Mano boa noite estou com esses erros abaixo

npm run build

backend@1.0.0 build tsc

src/services/WbotServices/wbotMessageListener.ts:152:77 - error TS2339: Property 'description' does not exist on type 'Location'.

152 await ticket.update({ lastMessage: msg.type === "location" ? msg.location.description ? "Localization - " + msg.location.description.split('\n')[0] : "Localization" : msg.body });


src/services/WbotServices/wbotMessageListener.ts:152:124 - error TS2339: Property 'description' does not exist on type 'Location'.

152   await ticket.update({ lastMessage: msg.type === "location" ? msg.location.description ? "Localization - " + msg.location.description.split('\\n')[0] : "Localization" : msg.body });

src/services/WbotServices/wbotMessageListener.ts:162:35 - error TS2339: Property 'description' does not exist on type 'Location'.

162 msg.body += "|" + (msg.location.description ? msg.location.description : (msg.location.latitude + ", " + msg.location.longitude))


src/services/WbotServices/wbotMessageListener.ts:162:62 - error TS2339: Property 'description' does not exist on type 'Location'.

162   msg.body += "|" + (msg.location.description ? msg.location.description : (msg.location.latitude + ", " + msg.location.longitude))

Found 4 errors.

Poderia me passar uma possivel solução desde já agradecido !

Luskan777 commented 6 months ago

Mano boa noite estou com esses erros abaixo

npm run build

backend@1.0.0 build tsc

src/services/WbotServices/wbotMessageListener.ts:152:77 - error TS2339: Property 'description' does not exist on type 'Location'.

152 await ticket.update({ lastMessage: msg.type === "location" ? msg.location.description ? "Localization - " + msg.location.description.split('\n')[0] : "Localization" : msg.body }); ~~~

src/services/WbotServices/wbotMessageListener.ts:152:124 - error TS2339: Property 'description' does not exist on type 'Location'.

152 await ticket.update({ lastMessage: msg.type === "location" ? msg.location.description ? "Localization - " + msg.location.description.split('\n')[0] : "Localization" : msg.body }); ~~~

src/services/WbotServices/wbotMessageListener.ts:162:35 - error TS2339: Property 'description' does not exist on type 'Location'.

162 msg.body += "|" + (msg.location.description ? msg.location.description : (msg.location.latitude + ", " + msg.location.longitude)) ~~~

src/services/WbotServices/wbotMessageListener.ts:162:62 - error TS2339: Property 'description' does not exist on type 'Location'.

162 msg.body += "|" + (msg.location.description ? msg.location.description : (msg.location.latitude + ", " + msg.location.longitude)) ~~~

Found 4 errors.

Poderia me passar uma possivel solução desde já agradecido !

Hi, here's the correction in my fork. Replace the link file to your respective target (backend/src/services/WbotServices/wbotMessageListener.ts)

Credits @egorky

disaring commented 6 months ago

That's solved but my chats getting delayed now. Any idea?

stale[bot] commented 3 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.