-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Correção para quando enviar uma localização. #1351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…etro content é do tipo string nas chamadas de findBotByTrigger() em chatbot.controller.
Reviewer's Guide by SourceryThis pull request fixes a type mismatch error that occurs when sending a location. The Sequence diagram for sending a locationsequenceDiagram
participant User
participant WhatsApp
participant getConversationMessage
participant chatbot.controller
User->>WhatsApp: Sends location
WhatsApp->>getConversationMessage: Receives message
activate getConversationMessage
getConversationMessage->>getConversationMessage: Converts degreesLatitude to string
getConversationMessage-->>WhatsApp: Returns message content
deactivate getConversationMessage
WhatsApp->>chatbot.controller: findBotByTrigger(content)
activate chatbot.controller
chatbot.controller-->>WhatsApp: Returns bot response
deactivate chatbot.controller
WhatsApp->>User: Sends bot response
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ricocorreia1 - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider adding a unit test to verify the location message is correctly converted to a string.
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
@@ -10,7 +10,7 @@ const getTypeMessage = (msg: any) => { | |||
conversation: msg?.message?.conversation, | |||
extendedTextMessage: msg?.message?.extendedTextMessage?.text, | |||
contactMessage: msg?.message?.contactMessage?.displayName, | |||
locationMessage: msg?.message?.locationMessage?.degreesLatitude, | |||
locationMessage: msg?.message?.locationMessage?.degreesLatitude.toString(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (bug_risk): Potential runtime error if degreesLatitude is undefined.
The change directly invokes toString() on degreesLatitude even though safe chaining is applied up to that property. If degreesLatitude is ever undefined, this call could throw an error. Consider using optional chaining (e.g., msg?.message?.locationMessage?.degreesLatitude?.toString()) or providing a fallback to ensure robustness.
locationMessage: msg?.message?.locationMessage?.degreesLatitude.toString(), | |
locationMessage: msg?.message?.locationMessage?.degreesLatitude?.toString(), |
Quando envia uma localização, faz a conversão de degreesLatitude para string, o parametro content é do tipo string nas chamadas de findBotByTrigger() em chatbot.controller e degreesLatitude é do tipo float causando erro de tipagem de dados.
Summary by Sourcery
Bug Fixes: